Error Handling

HTTP vs Business Errors

circle-info

Some endpoints return HTTP 200 even when the request fails.

Always check the response code and treat any non-success code as failure.

Trading Service Error Codes

Trading service errors may use a string code.

Envelope example:

error-envelop.json
{
  "code": "INVALID_INPUT",
  "message": "token addresses cannot be empty"
}

Input validation:

code
Meaning

INVALID_INPUT

Missing field / invalid format

INVALID_TOKEN

Invalid or unsupported token address

INVALID_AMOUNT

Invalid amount (non-positive / non-integer wei / format)

INVALID_PAIR

Unsupported or missing pair

INVALID_DEADLINE

Invalid deadline/expiry

Business errors:

code
Meaning

QUOTE_EXPIRED

Quote expired

INSUFFICIENT_LIQUIDITY

Not enough liquidity

NO_QUOTES

No quotes available

SLIPPAGE_EXCEEDED

Slippage check failed

System errors:

code
Meaning

INTERNAL_ERROR

Internal error

DATABASE_ERROR

Database error

REDIS_ERROR

Redis error

KAFKA_ERROR

Kafka error

SIGNING_ERROR

Signing-related error

TIMEOUT_ERROR

Timeout

Market Data Error Codes

Market data endpoints use numeric code.

code
Meaning

10000

Success

10095

Invalid parameters

20003

Internal service error

20004

Not found (e.g. pair not found)

Last updated