-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
feat: add error message details #922
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
👍 Looks good to me! Reviewed everything up to 1842dea in 17 seconds
More details
- Looked at
20
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. js/src/sdk/utils/error.ts:114
- Draft comment:
The error key for a 401 status should beERROR.BACKEND.UNAUTHORIZED
instead ofERROR.COMMON.API_KEY_UNAVAILABLE
to match the predefined error registry. - Reason this comment was not posted:
Comment was not on a valid diff hunk.
Workflow ID: wflow_g2FTPran21xIDAKz
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
js/src/sdk/utils/error.ts
Outdated
}else{ | ||
errorDetails = { | ||
message: axiosError.message, | ||
description: axiosError.response.data.message || axiosError.response.data.error || axiosError.message, |
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.
Consider adding null/undefined checks for axiosError.response
and axiosError.response.data
to prevent potential runtime errors. You could use optional chaining:
description: axiosError.response?.data?.message ||
axiosError.response?.data?.error ||
axiosError.message
@@ -111,8 +111,14 @@ export class CEG { | |||
errorKey = ERROR.BACKEND.UNKNOWN; | |||
break; | |||
} | |||
if (errorKey) { | |||
if (errorKey !== ERROR.BACKEND.UNKNOWN) { |
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.
The condition errorKey !== ERROR.BACKEND.UNKNOWN
might be more clear as errorKey && errorKey !== ERROR.BACKEND.UNKNOWN
to explicitly handle cases where errorKey might be undefined or null.
Code Review SummaryOverall AssessmentThe changes improve error handling by providing more detailed information for unknown backend errors, which is a valuable addition. The implementation is generally sound but could benefit from some minor improvements in robustness and error handling. Strengths✅ Adds more detailed error information for unknown errors Suggestions for Improvement
Code Quality Rating: 8/10Good implementation with room for minor improvements in robustness and safety. The changes are ready to be merged after addressing the suggested improvements for safer error handling. |
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.
👍 Looks good to me! Incremental review on a582e6b in 12 seconds
More details
- Looked at
13
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. js/src/sdk/utils/error.ts:105
- Draft comment:
The change fromERROR.COMMON.API_KEY_UNAVAILABLE
toERROR.BACKEND.UNAUTHORIZED
is consistent with the error definitions and improves clarity in error handling. - Reason this comment was not posted:
Confidence changes required:0%
The change fromERROR.COMMON.API_KEY_UNAVAILABLE
toERROR.BACKEND.UNAUTHORIZED
is consistent with the error handling logic and aligns with the error definitions in theERROR
object.
Workflow ID: wflow_ZykxLKer1LaVTcsz
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
This comment was generated by github-actions[bot]! JS SDK Coverage Report📊 Coverage report for JS SDK can be found at the following URL: 📁 Test report folder can be found at the following URL: |
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.
❌ Changes requested. Incremental review on aa8f2be in 59 seconds
More details
- Looked at
80
lines of code in2
files - Skipped
0
files when reviewing. - Skipped posting
0
drafted comments based on config settings.
Workflow ID: wflow_OOF07ozxxEVwDGNM
Want Ellipsis to fix these issues? Tag @ellipsis-dev
in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
errorDetails = PREDEFINED_ERROR_REGISTRY[errorKey]; | ||
}if(errorKey === ERROR.BACKEND.BAD_REQUEST){ |
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.
Logical error: The errorDetails
for BAD_REQUEST
are being overwritten with UNKNOWN
error details. Use PREDEFINED_ERROR_REGISTRY[ERROR.BACKEND.BAD_REQUEST]
instead.
…mposio into feat-random-errors-details
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.
👍 Looks good to me! Incremental review on 0fe5285 in 2 minutes and 20 seconds
More details
- Looked at
20
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
0
drafted comments based on config settings.
Workflow ID: wflow_suZ6Vcsav277clKz
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
…mposio into feat-random-errors-details
Important
Enhances error handling in
CEG.handleError()
with detailed messages for unknown backend errors, updates unauthorized error handling, and improves logging.CEG.handleError()
usingaxiosError
data.ERROR.BACKEND.UNAUTHORIZED
inCEG.handleError()
to useERROR.BACKEND.UNAUTHORIZED
instead ofERROR.COMMON.API_KEY_UNAVAILABLE
.x-request-id
to response logging insetAxiosClientConfig()
inconfig.ts
.eslint
script topackage.json
.index.ts
.This description was created by for 0fe5285. It will automatically update as commits are pushed.