-
Notifications
You must be signed in to change notification settings - Fork 15
Improve how the ENSRainbow client handles network errors #344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Improve how the ENSRainbow client handles network errors #344
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
| logger.debug(`Heal result:`, result); | ||
| return c.json(result, result.errorCode); | ||
|
|
||
| // Map error codes > 1000 to 500, otherwise use the original code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it ok?
| if ( | ||
| errorMessage.toLowerCase().includes("network") || | ||
| errorMessage.toLowerCase().includes("failed to fetch") || | ||
| errorMessage.toLowerCase().includes("fetch failed") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope it will catch these errors: #214
| return c.json(result, result.errorCode); | ||
|
|
||
| // Map error codes > 1000 to 500, otherwise use the original code | ||
| const statusCode = result.errorCode && result.errorCode >= 1000 ? 500 : result.errorCode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can result.errorCode >= 100 be ever true? We haven't changed anything int the server code, so it won't know about new error codes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are new error codes defined:
// Network error codes
TIMEOUT: 1000,
NETWORK_OFFLINE: 1001,
GENERAL_NETWORK_ERROR: 1099,
|
next steps: merge main & re-review |
shrugs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm concerned that the error handling here is slightly overly specified but not worth refactoring — LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
tk-o
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
#213