on_error()

Client.on_error()

Decorator for handling unexpected errors.

This does the same thing as add_handler() using the ErrorHandler.

Usable by Users Bots
Parameters:
  • exceptions (Exception | List of Exception, optional) – An exception type or a sequence of exception types that this handler should handle. If None, the handler will catch any exception that is a subclass of Exception.

  • filters (filters, optional) – Pass one or more filters to allow only a subset of messages to be passed in your function.

  • group (int, optional) – The group identifier, defaults to 0.