Wednesday, 27 July 2011

throw != raise, catch != rescue

This isn't even sysadmin stuff here, so if you don't care about Ruby, look away.

It is increasingly irritating when I'm trying to google examples of usage of Ruby's throw and catch functionality, that people who are very confused about the terminology of exceptions in Ruby appear to be writing tutorials. I can understand that they're writing about it coming from the perspective of some other language, but in Ruby you don't *throw* an exception, nor do you *catch* it because throw and catch are something different. The terminology is important because one set deals with exceptions (unexpected errors) and the other doesn't.

I want to see examples of throw and catch and it's made very difficult by the fact that everyone seems to use the exception stack for flow control (shudder) and referring to it by throw and catch, meaning I keep ending up reading badly worded tutorials on the exception handling tools which I already understand.

/rant

No comments:

Post a Comment

All comments and questions are welcome, just remember that I may not know the answer as I've only worked on my particular implimentation, and I have no responsibility to help you debug your problems.

That said, fire away!