Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

And in the opposite direction: remember when you are writing error messages to include all the relevant details, and never ever write "this shouldn't happen" or "document later".


What about, log_panic("If we have somehow managed to hit this code path, this project if FUBAR. I would recommend giving up and starting over.")


Somehow reminds me of Aliens:

  I say we take off and nuke the entire site from orbit. It's the only way to be sure.
:-)


That's annoying but fine as long as it's unique and you can grep it in the codebase.


You can forgo something being unique if you just append line and file information to the log. Literally any logging framework (even homerolled ones) should give you this by default.


yup


If used correctly, «this should not happen» can be very useful, indicating e.g that the program is in some illegal state, as opposed to the input being incorrectly formatted.


Even if that’s the case, create a custom exception and embed in the custom exception object the actual exception.


Assert




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: