Hacker News new | ask | show | jobs
by hackinthebochs 5033 days ago
If you need an exception here, you're just a bad programmer. It's your fault you didn't explicitly check that the lock was functional before poking that lion! /s
2 comments

Sure but are you telling me you always work on teams where everyone is shit hot?

If you write a library are you thinking that everyone is going to use it properly?

My point is that exceptions help people to learn how to use APIs (its kinda like documentation that appears through use!) and exceptions make things _safer_.

I appreciate you could write the above in two try catches but my point is that it would look more wrong. The code above _looks_ fine and that's my point.

Hah, I guess my post could have used a sarcasm tag :)

I totally agree that exceptions are far superior than checking return values.

But sometimes it's not just the programmer that gets bitten, it's all the other people at the zoo, too. Exceptions help protect everyone.