-
|
I have implemented Thank you! Edit: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
Doing it as side-effects in the Another option people sometimes do is adding additional information (like the error itself) into response extensions and then checking the extensions in a middleware. Personally, I would advise against the What would you say is the ideal scenario? How would you want it to work if anything was technically possible? This is an area that I think could be improved and it would be great to have opinions from users. |
Beta Was this translation helpful? Give feedback.
-
|
Thank you for your reply. I have added the This has ultimately achieved my desired goal of: 1) logging errors without repeating myself in every handler and 2) separating concerns of the type conversion and logging. One minor issue that I faced was that an Using |
Beta Was this translation helpful? Give feedback.
Doing it as side-effects in the
IntoResponseimplementation is currently the easiest solution.Another option people sometimes do is adding additional information (like the error itself) into response extensions and then checking the extensions in a middleware.
Personally, I would advise against the
map_errin handlers way because remembering to do that at every single place including all short-circuiting?would be almost impossible for any mid-sized project. Or maybe I'm just a pessimist.What would you say is the ideal scenario? How would you want it to work if anything was technically possible? This is an area that I think could be improved and it would be great to have opinions from…