code: def errorhandler(self, code_or_exception):
          
          def decorator(fn):
              self._defer(lambda app: app.register_error_handler(code_or_exception, fn))
              return fn
          return decorator
docs: Register a function to handle errors by code or exception class.
  
          A decorator that is used to register a function given an
          error code.  Example::
  
              @app.errorhandler(404)
              def page_not_found(error):
                  return 'This page does not exist', 404
  
          You can also register handlers for arbitrary exceptions::
  
              @app.errorhandler(DatabaseError)
              def special_exception_handler(error):
                  return 'Database connection failed', 500
  
          :param code_or_exception: the code as integer for the handler, or
                                    an arbitrary exception