async def _run_state(self, responder, state, trigger, request) \
            -> BaseState:
        """
        Execute the state, or if execution fails handle it.
        """

        user_trigger = trigger

        # noinspection PyBroadException
        try:
            if trigger:
                await state.handle()
            else:
                await state.confused()

            for i in range(0, settings.MAX_INTERNAL_JUMPS + 1):
                if i == settings.MAX_INTERNAL_JUMPS:
                    raise MaxInternalJump()

                trigger, state_class, dnr = \
                    await self._find_trigger(request, state.name(), True)

                if not trigger:
                    break

                logger.debug('Jumping to state: %s', state_class.name())
                state = state_class(request, responder, trigger, user_trigger)
                await state.handle()
        except Exception:
            logger.exception('Error while handling state "%s"', state.name())
            responder.clear()
            reporter.report(request, state.name())
            await state.error()

        return state
async def _run_state ( self , responder , state , trigger , request ) -> BaseState : user_trigger = trigger try : if trigger : await state . handle ( ) else : await state . confused ( ) for i in range ( 0 , settings . MAX_INTERNAL_JUMPS + 1 ) : if i == settings . MAX_INTERNAL_JUMPS : raise MaxInternalJump ( ) trigger , state_class , dnr = await self . _find_trigger ( request , state . name ( ) , True ) if not trigger : break logger . debug ( 'Jumping to state: %s' , state_class . name ( ) ) state = state_class ( request , responder , trigger , user_trigger ) await state . handle ( ) except Exception : logger . exception ( 'Error while handling state "%s"' , state . name ( ) ) responder . clear ( ) reporter . report ( request , state . name ( ) ) await state . error ( ) return state
Execute the state, or if execution fails handle it.