-
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: handle 400 error differently #1347
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
||
return { | ||
message: genericMessage, | ||
message: | ||
genericMessage + "Check .description for info.", |
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 error message concatenation here lacks proper spacing. Consider using template literals and adding a space: ```typescript
message: ${genericMessage} Check description for info.
|
||
return { | ||
message: genericMessage, | ||
message: | ||
genericMessage + "Check .description for info.", | ||
description: `Validation Errors: ${formattedErrors}`, |
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 a null/undefined check for formattedErrors
before using it in the description string. If validationErrors
is null/undefined, this could result in 'Validation Errors: undefined' being displayed.
Code Review SummaryOverall AssessmentThe changes improve error handling for 400 (Bad Request) responses, but there are a few areas that could use improvement: Strengths✅ Simplified error message structure Areas for Improvement
Recommendations
Code Quality Rating: 7/10Good functionality but could use some defensive programming improvements and better TypeScript practices. |
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. Reviewed everything up to 05678e4 in 1 minute and 36 seconds
More details
- Looked at
35
lines of code in2
files - Skipped
0
files when reviewing. - Skipped posting
6
drafted comments based on config settings.
1. js/src/sdk/utils/errors/src/constants.ts:35
- Draft comment:
The message for BAD_REQUEST was shortened, losing detail that previously specified the request was malformed. Confirm if this is intended. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50%
The comment is asking for confirmation of an intentional change, which violates our rule about not asking authors to confirm their intentions. The change appears to be a deliberate simplification, and the important details about malformed requests are still preserved in the possibleFix field. The shorter message is actually more consistent with other error messages in the file which are also concise.
The shortened message could potentially make it harder for users to understand the error at first glance without reading the possibleFix field.
The possibleFix field is the appropriate place for detailed guidance, and the change makes the error messages more consistent throughout the file. The change appears intentional and doesn't reduce the overall utility of the error handling.
Delete this comment as it violates our rule about asking for confirmation of intentions, and the change appears to be a deliberate improvement in message consistency.
2. js/src/sdk/utils/errors/src/formatter.ts:59
- Draft comment:
Fallback for formattedErrors: if details isn’t an array and messageFromResponse is undefined, description could be 'Validation Errors: undefined'. Consider providing a more reliable fallback. - Reason this comment was not posted:
Marked as duplicate.
3. js/src/sdk/utils/errors/src/constants.ts:35
- Draft comment:
The BAD_REQUEST message has been shortened. Confirm if removing the extra context ('malformed or incorrect') is intentional for backward compatibility. - Reason this comment was not posted:
Marked as duplicate.
4. js/src/sdk/utils/errors/src/formatter.ts:66
- Draft comment:
Append a space before 'Check .description for info.' to avoid concatenating words without a space. - Reason this comment was not posted:
Marked as duplicate.
5. js/src/sdk/utils/errors/src/formatter.ts:62
- Draft comment:
Consider a fallback if 'messageFromResponse' is undefined when 'validationErrors' is not an array, to prevent 'Validation Errors: undefined'. - Reason this comment was not posted:
Marked as duplicate.
6. js/src/sdk/utils/errors/src/formatter.ts:66
- Draft comment:
The error message concatenates 'genericMessage' and "Check .description for info." without an explicit space. This may lead to a run-on message if 'genericMessage' does not already end with a space. Consider adding a leading space before 'Check .description for info.' or adjusting the punctuation for better readability. - Reason this comment was not posted:
Marked as duplicate.
Workflow ID: wflow_gORXcfRzvBQ55Llu
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.
|
||
return { | ||
message: genericMessage, | ||
message: | ||
genericMessage + "Check .description for info.", |
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.
Appending 'Check .description for info.' to genericMessage may lack proper spacing if genericMessage is empty or doesn’t end with a space.
genericMessage + "Check .description for info.", | |
genericMessage + (genericMessage ? ' ' : '') + "Check .description for info.", |
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: |
Important
Improved handling of 400 errors by simplifying error messages and enhancing validation error descriptions in
formatter.ts
.COMPOSIO_SDK_ERROR_CODES.BACKEND.BAD_REQUEST
inconstants.ts
.formatter.ts
,getAPIErrorDetails()
now handles 400 errors by checking for validation errors and using the response message if no validation errors are present.formatter.ts
to improve error message construction logic.This description was created by
for 05678e4. It will automatically update as commits are pushed.