-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.go
More file actions
39 lines (31 loc) · 1.67 KB
/
Copy patherrors.go
File metadata and controls
39 lines (31 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package service
import (
"github.com/Conflux-Chain/go-conflux-util/api"
"github.com/pkg/errors"
)
var (
ErrRPCError = api.NewBusinessError(101, "RPC error, please try again later or check the detailed error message for more information")
// account abstract
ErrAccountAbstractTxNotFound = api.NewBusinessError(1001, "Set code transaction not found")
// Gas tank
ErrGasTankInsufficientBalance = api.NewBusinessError(2001, "Insufficient token balance in gas tank")
// token pay
ErrTokenPayPriceTooLow = api.NewBusinessError(3001, "Gas price too low")
ErrTokenPayGasCostTooHigh = api.NewBusinessError(3002, "Gas cost too high")
ErrTokenPayTransferTokenAmountTooLow = api.NewBusinessError(3003, "Transferred token amount too low")
ErrTokenPaySimulateTxFailed = api.NewBusinessError(3004, "Failed to simulate transaction")
ErrTokenPaySponsorBalanceNotEnough = api.NewBusinessError(3005, "Sponsor balance is insufficient, please contact the administrator")
// verifying paymaster
ErrVerifyingPaymasterMaxGasCostExceeded = api.NewBusinessError(4001, "Max gas cost exceeded")
ErrVerifyingPaymasterInvalidSmartAccount = api.NewBusinessError(4002, "Smart account is not in whitelist")
ErrVerifyingPaymasterContractNotWhitelisted = api.NewBusinessError(4003, "Contract is not in whitelist")
ErrVerifyingPaymasterPaused = api.NewBusinessError(4004, "Verifying paymaster contract is paused")
)
func NewRPCError(err error, message string, args ...any) *api.BusinessError {
if len(args) == 0 {
err = errors.WithMessage(err, message)
} else {
err = errors.WithMessagef(err, message, args...)
}
return ErrRPCError.WithData(err.Error())
}