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

Proposal: Adopt the httpproblems package for error reporting #772

Open
atheriel opened this issue Feb 12, 2021 · 2 comments
Open

Proposal: Adopt the httpproblems package for error reporting #772

atheriel opened this issue Feb 12, 2021 · 2 comments
Milestone

Comments

@atheriel
Copy link
Contributor

Plumber doesn't provide great tools to help users report errors (like a 400 Bad Request). The current advice seems to be to construct error responses manually. A few years ago I wrote about using conditions and custom error handlers to make this easier (and I doubt I'm the only one), but even at the time it was unclear to me what errors should actually look like.

It turns out there is an emerging, extensible standard for representing HTTP errors: RFC 7807. It seemed to me that a standard, consistent error format like this could be beneficial to the community. That line of thought has now turned into a new R package: httpproblems. It's already available on CRAN, and the README details how to use it with Plumber.

But going beyond that, I want to propose that Plumber adopt httpproblems for errors, both internally and as a recommendation to users for error handling. For instance, I think functions like stop_for_bad_request() could be re-exported for Plumber users directly.

Changing Plumber's existing default error responses is, of course, a breaking change to the users that are currently parsing them.

@schloerke schloerke added this to the v1.2.0 milestone Feb 12, 2021
@meztez
Copy link
Collaborator

meztez commented Feb 13, 2021

@atheriel wish you could see what I'm working on. This is pretty close to what I had in mind, thinking of error handlers like we do parsers with something like

@error 404 errorhandleralias

What @atheriel is proposing is the direction I think we should go with.

Great

@slwu89 slwu89 mentioned this issue Mar 9, 2022
3 tasks
@schloerke schloerke modified the milestones: v1.2.0, v1.3.0 Jun 6, 2022
@schloerke
Copy link
Collaborator

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