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

Use rlang's error generators to handle invocation and initialisation errors? #8

Open
jimjam-slam opened this issue Oct 17, 2021 · 0 comments

Comments

@jimjam-slam
Copy link

I proposed using a replacement for base::stop during endpoint initialisation and invocation so that you can pass HTTP error codes when invoking an endpoint using API Gateway.

Turns out rlang already has helpers for this. It can supply a class using the class argument, so that you can target it with error handlers, and you can supply metadata (like an HTTP code) using the dots.

It's not fundamentally different to what you're already doing, but if you want to shift some of the associated boilerplate to rlang's implementation (and perhaps not have API builders ask "What's stop_api"?), it's there and documented 🎉

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

1 participant