How would I cancel a request and return a response from a component


Suppose I have a fancy-pancy component that does something like return an authorized user, and ONLY an authorized user. I’d rather not get to calling the function if the component cannot initialize.

Can I, ala Flask, raise an “http status” as an exception from a component, aborting the rest of the execution of the request? Just raise 403 and be done?


Raise any subclass of exceptions.HTTPException

See here: