-
Notifications
You must be signed in to change notification settings - Fork 0
fix: add res.status to error message #36
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
Conversation
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.
Pull Request Overview
This PR fixes an issue where error messages could be incomplete when res.statusText
is undefined by including the HTTP status code in error messages.
- Updates error message construction to include both status code and status text
- Handles cases where
res.statusText
may be undefined by providing a fallback
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
create-fetchival.js
Outdated
} | ||
|
||
const err = new Error(res.statusText) | ||
const err = new Error(`${res.status} ${res.statusText || ''}`) |
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 format could result in trailing whitespace when res.statusText
is undefined. Consider using a more explicit format like ${res.status}${res.statusText ? ': ' + res.statusText : ''}
to avoid unnecessary spaces.
const err = new Error(`${res.status} ${res.statusText || ''}`) | |
const err = new Error(`${res.status}${res.statusText ? ': ' + res.statusText : ''}`) |
Copilot uses AI. Check for mistakes.
if |
no, before the error message is empty, after the error message is |
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.
utACK
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.
this is a frozen fetchival impl
replacement api is in experimental/ dir to ensure compat
this file will be removed in a major release, see #25
any changes that are exclusive to the file being removed don't make sense
left a comment in that PR |
cause res.statusText can be undefined