❔ Is Storing Predefined Error in Database a good approach
Hey guys, if it were you, would you rather store predefined errors in database, if error happen during query process then just throw it from procedure, and inside ASP.NET Core error handling middleware, just put the message and status code that sent back from database into the response body? I'm new to this so can you guys give me some thought about this and some better alternative approaches
4 Replies
i'm not 100% following but i will say this: the reason you put stuff in database is because 1) it can be updated 2) it has relationships 3) it's shared between services
if error messages are static, they are not editable templates or whatever (for example translations), perhaps i would not put them in a database
the usual process for that kinda thing is to shove all your messages and other localization bits into a separate assembly
they can still be swapped out, but it doesn't need to be quite so dynamic as a database
so you would have a key, or slug, for the string
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.