def handle_error(self, item_session: ItemSession, error: BaseException) -> Actions:
        '''Process an error.

        Returns:
            A value from :class:`.hook.Actions`.
        '''
        if not self._ssl_verification and \
                isinstance(error, SSLVerificationError):
            # Change it into a different error since the user doesn't care
            # about verifying certificates
            self._statistics.increment_error(ProtocolError())
        else:
            self._statistics.increment_error(error)

        self._waiter.increment()

        action = self.consult_error_hook(item_session, error)

        if action == Actions.RETRY:
            item_session.set_status(Status.error)
        elif action == Actions.FINISH:
            item_session.set_status(Status.done)
        elif action == Actions.STOP:
            raise HookStop('Script requested immediate stop.')
        elif self._ssl_verification and isinstance(error, SSLVerificationError):
            raise
        elif isinstance(error, ConnectionRefused) and \
                not self.retry_connrefused:
            item_session.set_status(Status.skipped)
        elif isinstance(error, DNSNotFound) and \
                not self.retry_dns_error:
            item_session.set_status(Status.skipped)
        else:
            item_session.set_status(Status.error)

        return action
Process an error.

        Returns:
            A value from :class:`.hook.Actions`.