realm-js
realm-js copied to clipboard
Have a unique error code for each error message
Goals
Be able to distinguish authentication errors by their code.
Expected Results
Have a unique error code for every error message.
Actual Results
When logging in realm with a JWT token, I can receive the following error codes (among others):
{code:46, message: "user disabled"}
{code:47, message: "(something about authentication failed...) ; token is expired"}
{code:47, message: "failed to lookup key for kid=..."}
The last one occurs when I try to log in my production realm with a staging JWT, for instance.
It doesn't seem logic to me to have the same error code for two different errors, especially since my app should behave differently in case I get a 47 error code:
- "failed to lookup..." => logout, clear token cache
- "token expired" => renew token, then retry to log in Realm
Version of Realm and Tooling
- Realm JS SDK Version: 10.0.0-rc.1
- Node or React Native: React Native
- Client OS & Version: macOS 10.15.7
- Which debugger for React Native: None