Refactor exception handling code

This came out of a discussion with Atgeirr. The class hierarchy defined now resembles the one of &lt;exception> and &lt;stdexception> plus some minor additions like the NumericalProblem exception.

Note, that once the discussion is complete I will create PRs for all other modules to adapt them to The New Ways (TM).