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

Sorry, I probably wasn't very clear - I'm not arguing that a try/except MUST be very targeted.

> without an understanding of IF it should and WHY it might

rocqua explains it best - the API handler is an "input" to the overall system. That input may be "invalid" in that it fails to handle its own errors. In that case, you should catch a general exception rather than crashing. In this case, you know that it might raise an error, why it might raise an error, and that it's OK to ignore (well, log/alert/whatever.)

The situation I was responding to is very different - it's basically suggesting rather understand what the API you're invoking may be trying to tell you, just try/catch anything it throws and ignore it if you didn't expect it.



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

Search: