Exceptions from middleware/ Design #3839
Unanswered
vishnu-itachi
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Suppose I have to support auth and also log requests, responses, and users (from auth if used in a request or "open" if some endpoints are excluded for auth)
I have created AuthMiddleWare and RequestResponseMiddleWare and added them while instantiating the LiteStar app.
The Auth MiddleWare might throw some HTTP Exceptions when some roles or conditions are unmet.
Since the ReqRes Middleware also logs users this means the order of middleware is [auth, reqres]
Now if some exception is thrown in Auth Middleware .. it does not get propagation to the Next middleware .. as message['body']
Do you have anything I am missing or any better way to implement it?
Thanks for this awesome project :)
Beta Was this translation helpful? Give feedback.
All reactions