code: def register_error_handler(
              self, error: Union[Type[Exception], int], func: Callable, name: AppOrBlueprintKey=None,
      ) -> None:
          
          handler = ensure_coroutine(func)
          if isinstance(error, int):
              error = all_http_exceptions[error]
          self.error_handler_spec[name][error] = handler
docs: Register a function as an error handler.
  
          This is designed to be used on the application directly. An
          example usage,
  
          .. code-block:: python
  
              def error_handler():
                  return "Error", 500
  
              app.register_error_handler(500, error_handler)
  
          Arguments:
              error: The error code or Exception to handle.
              func: The function to handle the error.
              name: Optional blueprint key name.