Add support for custom error handlers