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.
messageis a fixed English string fromApiError.message; the API does not localize. User-facing UIs mapcodeto 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
}
codeis an integer error code, for example10002 Balance not enough,10211 Insufficient balance for payment, or10220 Payment order not found; see Admin → Errors.messageis human-readable English text intended for technical operators; user-facing UIs typically mapcodeto a localized string.- On success,
resultcarries the payload anderrorisnull— there is nosuccessflag.