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

This! I'd like to think exceptions are reasonable as a terminal state for a particular user workflow, which sometimes even end up having the program terminated. Examples include "unexpected I/O, corrupt files etc."

Exceptions should never be used if the control flow has means to recovery. For example, if-else statements with more different, downstream instructions.



What about, say, a webhook server that must call User-provided webhooks, and retry them on failures, or handle maximum request duration?

I’d argue throwing well-nested exceptions, catching them and retrying is the most elegant solution to this problem there is.




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

Search: