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?
to your account
On HTTPErrors the statusCode of the response is not exposed directly. You have to go through the HTTPError.response to get the statusCode
I would've expected the statusCode to be directly exposed on the HTTPError or otherwise set as the value of the code property, but neither is true
Is that as expected or is this a bug?
The text was updated successfully, but these errors were encountered:
In regards to the documentation this is expected.
Sorry, something went wrong.
Tnx for the quick response.
I wasn't able to deduct this from the documentation, so thanks for clarifying
Additionally: shouldn't the code property on HTTPError instances be set to 'HTTPError'? According to the docs: Contains a code property with error class code, like ECONNREFUSED
Contains a code property with error class code, like ECONNREFUSED
Per @sindresorhus comments in #1739 it would be good to take a comprehensive approach to the code property for all error objects. The plain RequestError seems to always have a code associated with it that correlates to a Linux kind of error
[ 'ETIMEDOUT', 'ECONNRESET', 'EADDRINUSE', 'ECONNREFUSED', 'EPIPE', 'ENOTFOUND', 'ENETUNREACH', 'EAI_AGAIN' ]
The other child error messages all seem to return with the code property as undefined. As also stated it would be good to follow a Node.JS convention of ERR_*.
I might suggest
Otherwise, looks good to me.
ERR_READING_REQUEST_STREAM -> ERR_UPLOAD
HTTPError code set to 'HTTPError' #1711 (#1739)
No branches or pull requests