More flexible exception handling.

Add base class for our exceptions and let several subclasses extend it.
Merge pull request #10 from marcjansen/exceptions

More flexible exception handling.