3 ms·
I used to do the same thing. Then, the error that spelled "This should never happen!" started to pop up. A couple of years after the original code was written.
by ddalex 11y ago
I used to do the same thing. Then, the error that spelled "This should never happen!" started to pop up. A couple of years after the original code was written.
Now, older and wiser, I include full stack trace and my explicit assumptions on all errors - orders of magnitude easier to debug than cryptic error messages. Treat your future self kindly !
- 72deluxe 11y agoI put asserts in code for things that shouldn't happen. Sometimes I put them in debug mode only for friendlier behaviour.
- jakejake 11y agoI usually have error logging/reporting with full stack trace. This was a quick one-off that I definitely didn't mean to commit! One web app that I worked on years ago would save the entire session state of the user on error. We had a dev tool that would allow us to jump in with all of our session state all set exactly as this user on the exact spot where they had the error. It was pretty great for reproducing most errors except one pesky one that would show up in the logs randomly. Finally, one day I accidentally triggered that annoying error by doing a specific sequence of things and then clicking the browser back button a few times, then doing another specific sequence. That was a day of celebration!