Error Handling
Error Codes
All the errors returned by the SDK come in form of an EkoException
. The possible error codes are listed in a public EkoError
enum: each case is named after its error and they are designed to be self explanatory.
Server Errors
Error | Code |
BAD_REQUEST_ERROR | 400000 |
INVALID_REGULAR_EXPRESSION | 400001 |
UNAUTHORIZED_ERROR | 400100 |
FORBIDDEN_ERROR | 400300 |
PERMISSION_DENIED | 400301 |
USER_IS_MUTED | 400302 |
CHANNEL_IS_MUTED | 400303 |
USER_IS_BANNED | 400304 |
NUMBER_OF_MEMBER_EXCEED | 400305 |
EXEMPT_FROM_BAN | 400306 |
MAX_REPETITION_EXCEED | 400307 |
BAN_WORD_FOUND | 400308 |
LINK_NOT_ALLOWED | 400309 |
TOO_MANY_MEMBER_ERROR | 400310 |
RPC_RATE_LIMIT_ERROR | 400311 |
USER_IS_GLOBAL_BANNED | 400312 |
ITEM_NOT_FOUND | 400400 |
CONFLICT | 400900 |
BUSINESS_ERROR | 500000 |
Client Errors
Error | Code |
UNKNOWN | 800000 |
INVALID_PARAMETER | 800110 |
MALFORMED_DATA | 800130 |
FILE_SIZE_EXCEEDED | 800140 |
CONNECTION_ERROR | 800210 |
You can convert an EkoException
into EkoError
enum with the following:
When an error is returned as a result of an action from your side (e.g. trying to join a channel), the action can considered complete, and the SDK will not execute any additional logic.
Asynchronous Errors
The EkoClient
class includes the EkoClient.errors()
method that can be called and observed to asynchronous errors. This observable object notifies you of errors that can potentially break the functionality of the SDK. The SDK logic is usually robust enough to automatically handle most errors, as such, only unrecoverable errors are exposed through this observable (for example, if the login session was invalidated).
We recommend you to always handle these errors in a production app by gracefully disabling messaging functionality in the event of an error.
Last updated