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 outrlang 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 🎉
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 theclass
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'sstop_api
"?), it's there and documented 🎉