Have a unique error code for each error message
See original GitHub issueGoals
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
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Why different error codes for same Exception? - Stack Overflow
I am doing one synchronization example. I got two exceptions which are having same details about exception. But with the error codes. And...
Read more >Your own error code | Andrzej's C++ blog - WordPress.com
I was recently implementing the "classification of error conditions" in my application offered by the functionality behind std::error_code.
Read more >Hulu Error Codes: What They Are and How to Fix Them
There are dozens of different Hulu error codes and Hulu error messages aren't always crystal clear in terms of explaining the problem.
Read more >Best Practices for exceptions - .NET - Microsoft Learn
Learn best practices for exceptions, such as using try/catch/finally, handling common conditions without exceptions, and using predefined .
Read more >Custom errors, extending Error - The Modern JavaScript Tutorial
The Apple error objects have a unique code and message property assigned to the error objects. Similarly on JS, an application can add...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@euZebe The docs team will soon create complete list of error codes with some guidance of error handling.
I got the
failed to lookup key for kid
error again ; it went from the fact that I can switch between staging and production environments in my app, then I can switch between two realms app. The error happens when I accidently try to open the staging realm app instead of the production realm app. In my opinion, it would be great to update the error message:failed to lookup key for kid=... ; perhaps you are trying to open the wrong realm app ID
.