Skip to main content

Error Handling

TrexWallet implements robust error handling to ensure reliability and transparency. Errors are categorized and returned with clear messages and codes.

Key Points

  • All API responses include an error code and message if an error occurs.
  • Errors are logged for auditing and troubleshooting.
  • message is a fixed English string from ApiError.message; the API does not localize. User-facing UIs map code to a localized string.

Example Error Response

TrexWallet returns errors in the ApiResponse<T> envelope:

{
"result": null,
"error": {
"code": 10002,
"message": "Balance not enough"
},
"id": 0
}
  • code is an integer error code, for example 10002 Balance not enough, 10211 Insufficient balance for payment, or 10220 Payment order not found; see Admin → Errors.
  • message is human-readable English text intended for technical operators; user-facing UIs typically map code to a localized string.
  • On success, result carries the payload and error is null — there is no success flag.