zorchenhimer / MoviePolls

Voting to decide on a movie to watch with MovieNight
https://discord.gg/F2VSgjJ
16 stars 6 forks source link

Custom errors galore #130

Open CptPie opened 2 years ago

CptPie commented 2 years ago

Time to add custom errors for ALL returned errors.

You might be wondering why? Easy! to have a consistent codebase, either have it everywhere or nowhere!

Thx to @zorchenhimer :P

Have fun with the PR - it wont be pretty.

CptPie commented 2 years ago

23:55 CptPie1: btw for the custom errors in moviepolls i had an interesting idea - having extra fields in the custom errors such that the error has the usual "message" as well as a "user friendly message" 23:56 CptPie1: where "message" would contain debug info while "user friendly message" contains user presentable feedback ("contact the admin because he fked up") 23:57 edorfaus: that makes a lot of sense to me CptPie1 23:58 edorfaus: then the top-level response handler could just look for the user-friendly-error interface to decide whether to respond with a generic message, or something from the error itself 23:58 CptPie1: smth else i just thought about, a "global" error counter, the usecase being to include that counter in both messages and as such the user can report the issue (with the error number [which is unique and incrementing]) to the admin and he could just search the logs for the respective log entry 23:58 edorfaus: and the rest of the code doesn't have to choose between useful-for-admin info and useful-for-user info 0:00 edorfaus: oh yeah, we've done that at work CptPie1 (though using random UUIDs instead of an auto-increment, to avoid needing central coordination of generation (including locks etc))