Libraries, exceptions, and debugging

In some work I was doing with a ruby extension, state_machine. I ended up running into a very frustrating but simple problem with an exception I was receiving. I think this is a good opportunity to talk about exceptions especially with regard to libraries. If you just want the answer, you may want to look toward the end for the solution or how to debug these type of problem.


Exceptions are a very common way in most programming languages to establish that something went wrong. They are unique in that they terminate the current context and move up a level. Depending on language, these may need to be dealt with at the level that receives the exception or it may simply raise the exception to the next higher level automatically.

Exceptions are a bad thing to occur. I bring this up since most languages makes them extremely easy to handle in most cases. This can lead to bad practices of using exceptions to convey different statuses or otherwise something other than an error that is unrecoverable at the level at which it will be raised.

In my experience, exceptions come up most (though not exclusively) in environments where there is an element of classes. This allows for the use of typed exceptions. One of the main advantages to this is the ability to handle different types of exceptions differently. This will become extremely important later.


  • Pensiuni Cheile Bicazului

    2014-06-16 at 6:17 am

    Hoteluri 2 Mai

    Hey! This post couldn’t be written any better!
    Reading through this post reminds me of my old room mate!

    He always kept talking about this. I will forward this article
    to him. Pretty sure he will have a good read. Thanks for sharing!

  • Chestionare Auto

    2014-11-01 at 3:59 am

    Hi. Can i Share Libraries, exceptions, and debugging to my Facebook page?

Post a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.