Skip to content
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

ParseError should contain err.statusCode #182

Closed
satazor opened this issue Mar 2, 2016 · 5 comments
Closed

ParseError should contain err.statusCode #182

satazor opened this issue Mar 2, 2016 · 5 comments

Comments

@satazor
Copy link
Contributor

satazor commented Mar 2, 2016

curl -v https://api.github.com/repos/震动/generator-test should output a json but it does print an HTML pages, which gives a ParseError if we use got() with options.json=true. Though, I was expecting that the ParseError contained the err.statusCode property, which doesn't at the moment. It has to be accessed via err.response.statusCode which kind sucks :(

Thoughts?

@sindresorhus
Copy link
Owner

👍

@floatdrop
Copy link
Contributor

Yes, it should for consistency, because other errors have these fields.

@satazor
Copy link
Contributor Author

satazor commented Mar 3, 2016

PR done.

floatdrop added a commit that referenced this issue Mar 3, 2016
Add statusCode to ParseError, closes #182.
@satazor
Copy link
Contributor Author

satazor commented Mar 3, 2016

I haven't added because thats already covered in the error introduction:

Each error contains (if available) statusCode, statusMessage, host, hostname, method and path properties to make debugging easier.

Still do you want the statusCode and statusMessage mentioned in the ParseError?

@satazor
Copy link
Contributor Author

satazor commented Mar 3, 2016

Oh nvm you added that recently aha. 💃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants