Allow exception types to be registered for format functions

Implementation of idea in #70, let me know what you think.

The one thing I was unsure of, is when an exception is caught, should it still have the default `'foo' is not a 'bar'` error message before the message from the caught exception?