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

> If thats the case all guarantees are out the window and usually the best / only thing you can do is to crash and allow the process to restart.

I've found that there are a lot of minor bugs in the implementation that, in something client-facing (e.g. not on a server somewhere that can simply be taken out of the load balancing rotation until it restarts or whatever) probably shouldn't crash.

Report and log errors remotely - to be fixed - and skip some logic that relied on those guarantees, but not crash.

> Also in those case (in my experience) having a human-readable error message is rarely useful.

I'll settle for developer-readable, then ;). Panic can format error messages, and itself provides context information (the file and line you mention) as a decent means of reporting fatal errors. Some assertions are obvious enough as to their reason and cause from context - as you say, they don't need a message.

But I've also found taking the 10 seconds or so to think of a decentish error message pays off quite frequently. Even if I'm pretty sure it's unnecessary. Sometimes it may save me only a minute of context switching by telling me exactly what the problem was (instead of roughly describing some assumption made for unknown reasons), sometimes the only way I can make progress is by adding more logging and messaging and reproducing the problem because I couldn't suss out exactly what was happening - and deciding this could take a lot longer than a minute if I know it's hard to reproduce.



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

Search: