Error code consists of two parts - Number(error domain + error code). For instance if you'll try to fetch not supported pair of tokens - you get an error with code "2001", because Number(''002" + "001") equals 2001. Every error is related with particular stage of interaction with API (ex. making quote request, making swap request, interaction with Rubic smart contracts).
Currently errors list contains 5 main issues like invalid params, calculation restrictions etc. In future this list will grow as we develop and scale our API. To receive all actual data or mention any discrepency or incorrectness in errors list - contact our BD via Telegram .
Errors may have different structures.PARAMS_ERRORS is an array of errors(it's related with NestJS exceptions of validation pipes)
PARAMS_ERROR example
{
errors: [
{
code: 1999,
reason: "fromAddress with value 0x12esa isn't a correct wallet address for ETH network"
},
{
code: 1999,
reason: "receiver with value 0x12esa isn't a correct address in POLYGON"
}
]
}
Common error example
A usual(exceptPARAMS_ERRORS) error body has a type like
{
error: {
code: number,
reason: string,
// Error specific data
data?: object
},
id: string
}
NO_ROUTES
{
error: {
code: 2001,
reason:"No routes found. Try to use other tokens"
},
// used to fetch status of successfull cross-chain transaction in destinatio chain
id: "0367294f-2866-43b6-a937-5e928e8350b7"
}
Error with additional "data" field example
Errors can have optional field "data" (object), this field contains additional useful data and details about error cause.
NEED_APPROVE
{
error: {
code: 3001,
reason: "Trade can not be executed. You have not enough allowance for 0x3335733c454805df6a77f825f266e136FB4a3333 spender address",
data: {
contractAddress: "0x3335733c454805df6a77f825f266e136FB4a3333"
}
},
// used to fetch status of successfull cross-chain transaction in destination chain
id: "0367294f-2866-43b6-a937-5e928e8350b7"
}
NOT_ENOUGH_NATIVE_BALANCE (EVM chains)
{
error: {
code: 3004,
reason: "Transaction simulation failed. You probably have not enough native currency to pay for transaction on 0x7E1FdF03Eb3aC35BF0256694D7fBe6B6d7b3E0c8 wallet address. You can find approximate gas data for tx in "data".",
data: {
gasLimit: "562800",
gasPrice: "2285283281",
//tx value
value: "1050000000000000000"
}
},
// used to fetch status of successfull cross-chain transaction in destination chain
id: "0367294f-2866-43b6-a937-5e928e8350b7"
}
NOT_ENOUGH_NATIVE_BALANCE (TON)
{
error: {
code: 3004,
reason: "Transaction simulation failed. You probably have not enough native currency to pay for transaction on EQBsSItDkR-1_2CiAMxl7MDraJuEopRcw0qQZjso9pAhaVbF wallet address. You can find approximate gas data for tx in "data".",
data: {
gas: "200000000",
value: "1050000000000000000"
}
},
// used to fetch status of successfull cross-chain transaction in destination chain
id: "0367294f-2866-43b6-a937-5e928e8350b7"
}