You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
@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
@error404errorhandleralias
What @atheriel is proposing is the direction I think we should go with.
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.
The text was updated successfully, but these errors were encountered: