def add_error_handler(self, exception, handler=None):

        if handler is None:
            try:
                handler = exception.handle
            except AttributeError:
                raise AttributeError('handler must either be specified '
                                     'explicitly or defined as a static'
                                     'method named "handle" that is a '
                                     'member of the given exception class.')

        # Insert at the head of the list in case we get duplicate
        # adds (will cause the most recently added one to win).
        self._error_handlers.insert(0, (exception, handler))
Registers a handler for a given exception error type.
dataset/ETHPy150Open falconry/falcon/falcon/api.py/API.add_error_handler