This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Proper way to get more data in catchers #2462
Labels
suggestion
A suggestion to change functionality
Existing Functionality
I want to pass details to catchers. From a Guard there is the request.local_cache, which works but is sometimes error prone to set up as it has to typed correctly on both ends (setting and retrieving) and has to wrapped by an option. But the main problem with that is that there is no way of setting it within a request handler itself. I for example validate my incoming data in a request guard but then store it in the database later in the request handler. If that fails i can only manullay return an error instead of say passing a string and then sending a generic response with that custom message, which would reduce code duplication.
Suggested Changes
some way to store data in the request more conveniently, which is accesible from every part of the code touching the request somehow.
Alternatives Considered
being able to write to the request local_cache within request handler
Additional Context
if you want to have a look at my code in order to understand the problem better or suggest better ways feel free to take a look:
TPausL/power-music-backend
The text was updated successfully, but these errors were encountered: