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

Annotate http status assertion #300

Closed
wants to merge 1 commit into from
Closed

Annotate http status assertion #300

wants to merge 1 commit into from

Conversation

jeroen
Copy link
Member

@jeroen jeroen commented Dec 17, 2015

See #277. Adds option to annotate the stop_for_status error message with an assertion. This can be helpful for http client packages to provide more informative error feedback to the user.

req <- GET("https://httpbin.org/status/404")
stop_for_status(req)
## Error: client error: (404) Not Found

# More informative error
stop_for_status(req, "find spreadsheet")
## Error: find spreadsheet failed: (HTTP 404)

@jeroen jeroen changed the title Annotate http status assertation Annotate http status assertion Dec 17, 2015
@hadley
Copy link
Member

hadley commented Dec 17, 2015

I think I'd prefer the errors to be a bit more parallel:

stop_for_status(req)
## Error: Not found (HTTP 404)

stop_for_status(req, "Find spreadsheet failed")
## Error: Find spreadsheet failed (HTTP 404)

But I can take it from here

@hadley hadley closed this Dec 17, 2015
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.

2 participants