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

Move top-level error properties into an .options and .response property #773

Merged
merged 6 commits into from Apr 24, 2019

Conversation

szmarczak
Copy link
Collaborator

@szmarczak szmarczak commented Apr 10, 2019

This PR just simplifies error properties. As for now you can access error options in two ways:

  1. error.hostname
  2. error.gotOptions.hostname

They return the same value. So I removed Object.assign(this, options); and renamed gotOptions to options. So you need to do just error.options.hostname.

Same with the response property. Instead of error.statusCode you need to do error.response.statusCode.

Checklist

@sindresorhus sindresorhus changed the title No duplicated error properties Move top-level error properties into a .options and .response property Apr 24, 2019
@sindresorhus sindresorhus changed the title Move top-level error properties into a .options and .response property Move top-level error properties into an .options and .response property Apr 24, 2019
@sindresorhus sindresorhus merged commit 6eaa81b into sindresorhus:master Apr 24, 2019
@szmarczak szmarczak mentioned this pull request Sep 28, 2019
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

Successfully merging this pull request may close these issues.

Issue with adding the request/response body to errors
2 participants