ThinkR-open / mariobox

A Framework For Packaging {plumber} APIs
Other
38 stars 1 forks source link

Add client/server error handling logic to template #3

Closed psolymos closed 1 year ago

psolymos commented 2 years ago

As described in #1 we can add try/catch mechanism to distinguish client and server errors.

The main differences:

The PR adds mariobox::http_error() as a drop in replacement for stop() that contains the message and the intended status code.

mariobox::mario_try() wraps the internal function and modifies the response object based on the class of the condition object when an error happened.

ALanguillaume commented 1 year ago

Thanks a lot for the PR ! Sorry it was left on hold for so long. We had very little bandwidth to work on the project.