Added custom error handlers.
Fixes #9.