'Registers an error handler that becomes active for this blueprint
only.  Please be aware that routing does not happen local to a
blueprint so an error handler for 404 usually is not handled by
a blueprint unless it is caused inside a view function.  Another
special case is the 500 internal server error which is always looked
up from the application.
Otherwise works as the :meth:`~flask.Flask.errorhandler` decorator
of the :class:`~flask.Flask` object.'

def errorhandler(self, code_or_exception):

    def decorator(f):
        self.record_once((lambda s: s.app._register_error_handler(self.name, code_or_exception, f)))
        return f
    return decorator
