Handles the case where a state which is the target of a transition is not found, and the user can optionally retry or defer the transition
185696
function handleRedirect(redirect, state, params, options) {
      /**
       * @ngdoc event
       * @name ui.router.state.$state#$stateNotFound
       * @eventOf ui.router.state.$state
       * @eventType broadcast on root scope
       * @description
       * Fired when a requested state **cannot be found** using the provided state name during transition.
       * The event is broadcast allowing any handlers a single chance to deal with the error (usually by
       * lazy-loading the unfound state). A special `unfoundState` object is passed to the listener handler,
       * you can see its three properties in the example. You can use `event.preventDefault()` to abort the
       * transition and the promise returned from `go` will be rejected with a `'transition aborted'` value.
       *
       * @param {Object} event Event object.
       * @param {Object} unfoundState Unfound State information. Contains: `to, toParams, options` properties.
       * @param {State} fromState Current state object.
       * @param {Object} fromParams Current state params.
       *
       * @example
       *
       * <pre>
       * // somewhere, assume lazy.state has not been defined
       * $state.go("lazy.state", {a:1, b:2}, {inherit:false});
       *
       * // somewhere else
       * $scope.$on('$stateNotFound',
       * function(event, unfoundState, fromState, fromParams){
       *     console.log(unfoundState.to); // "lazy.state"
       *     console.log(unfoundState.toParams); // {a:1, b:2}
       *     console.log(unfoundState.options); // {inherit:false} + default options
       * })
       * </pre>
       */
      var evt = $rootScope.$broadcast('$stateNotFound', redirect, state, params);

      if (evt.defaultPrevented) {
        $urlRouter.update();
        return TransitionAborted;
      }

      if (!evt.retry) {
        return null;
      }

      // Allow the handler to return a promise to defer state lookup retry
      if (options.$retry) {
        $urlRouter.update();
        return TransitionFailed;
      }
      var retryTransition = $state.transition = $q.when(evt.retry);

      retryTransition.then(function() {
        if (retryTransition !== $state.transition) return TransitionSuperseded;
        redirect.options.$retry = true;
        return $state.transitionTo(redirect.to, redirect.toParams, redirect.options);
      }, function() {
        return TransitionAborted;
      });
      $urlRouter.update();

      return retryTransition;
    }
315176
function recrawlError(error, options, callback) {

      if (options.currentRetries <= options.retries) {
        onRecrawl(error,options, callback);
      }
      else {
        callback();
      }
  }
955582
def _state_error(self, reason):
        
        log.err(reason)

        def matchException(failure):
            for errorState, backOff in self.backOffs.iteritems():
                if 'errorTypes' not in backOff:
                    continue
                if failure.check(*backOff['errorTypes']):
                    return errorState

            return 'other'

        errorState = matchException(reason)
        self._reconnect(errorState)
761094
function handleTransitionEnd(priv, evt) {
  if (evt.propertyName in priv.phaseTriggers &&
      priv.phaseTriggers[evt.propertyName].indexOf(evt.target) !== -1) {
    nextPhase(priv);
  }
}
1247854
@CheckReturnValue
  Context transitionToState(HtmlContext state) {
    Context.Builder builder = toBuilder().withState(state).withUriPart(UriPart.NONE);
    if (uriPart != UriPart.NONE) {
      // Only reset the URI type if we're leaving a URI; intentionally, URI type needs to
      // remain prior to the URI, for example, to maintain state between "src", the "=", and
      // the opening quotes (if any).
      builder.withUriType(UriType.NONE);
    }
    return builder.build();
  }
980397
def handle_error(error)
      return unless que_target

      max = resolve_que_setting(:maximum_retry_count)

      if max && error_count > max
        expire
      else
        retry_in_default_interval
      end
    end
183938
def _prepare_transition(self, is_on=None, **kwargs):
        
        # Handle transitions with changing on-off-state
        dest_state = kwargs.copy()
        if is_on is not None:
            if is_on and not self.is_on:
                if 'brightness' not in kwargs or kwargs['brightness'] is None:
                    dest_state['brightness'] = self.brightness
                self.set(brightness=0, cancel_transition=False)
            elif not is_on and self.is_on:
                dest_state['brightness'] = 0

        return dest_state
209402
def validate_state_transition(self, user, start_state, end_state, **kwargs):
        
        if start_state == end_state:
            raise Return(True)

        transitions = self.state_transitions.get(start_state, [])

        approved_transitions = []
        can_approve = yield self.can_approve(user, **kwargs)
        if can_approve:
            approved_transitions = self.approval_state_transitions.get(start_state, [])

        if end_state not in transitions and end_state not in approved_transitions:
            raise Return(False)

        raise Return(True)
886220
function processEmptyState(state, action) {
    const { path, data } = action.payload;
    const pathItems = path.split("/");
    return objectPathImmutable.update(state, pathItems, targetState => {
        Object.keys(data).forEach(key => {
            delete targetState[key];
        });
        return targetState;
    });
}
6253
function evaluateState(state, instance, message) {
    var result = false;
    // delegate to child regions first if a non-continuation
    if (message !== state) {
        state.regions.every(function (region) {
            var currentState = instance.getLastKnownState(region);
            if (currentState && evaluateState(currentState, instance, message)) {
                result = true;
                return isActive(state, instance); // NOTE: this just controls the every loop; also isActive is a litte costly so using sparingly
            }
            return true; // NOTE: this just controls the every loop
        });
    }
    // if a transition occured in a child region, check for completions
    if (result) {
        if ((message !== state) && isComplete(state, instance)) {
            evaluateState(state, instance, state);
        }
    }
    else {
        // otherwise look for a transition from this state
        var transitions = state.outgoing.filter(function (transition) { return transition.guard(message, instance); });
        if (transitions.length === 1) {
            // execute if a single transition was found
            result = traverse(transitions[0], instance, message);
        }
        else if (transitions.length > 1) {
            // error if multiple transitions evaluated true
            exports.console.error(state + ": multiple outbound transitions evaluated true for message " + message);
        }
    }
    return result;
}
1121046
public void createStateDefaultTransition(final TransitionableState state, final String targetState) {
        if (state == null) {
            LOGGER.trace("Cannot add default transition of [{}] to the given state is null and cannot be found in the flow.", targetState);
            return;
        }
        val transition = createTransition(targetState);
        state.getTransitionSet().add(transition);
    }
334649
function handleOnBeforeWebHook(transition) {
      setTransitionProperties(transition);
      var statePermissionMap = new PermStatePermissionMap(PermTransitionProperties.toState);

      return PermStateAuthorization
        .authorizeByPermissionMap(statePermissionMap)
        .catch(function (rejectedPermission) {
          return statePermissionMap
            .resolveRedirectState(rejectedPermission)
            .then(function (redirect) {
              return transition.router.stateService.target(redirect.state, redirect.params, redirect.options);
            });
        });

      /**
       * Updates values of `PermTransitionProperties` holder object
       * @method
       * @private
       */
      function setTransitionProperties(transition) {
        PermTransitionProperties.toState = transition.to();
        PermTransitionProperties.toParams = transition.params('to');
        PermTransitionProperties.fromState = transition.from();
        PermTransitionProperties.fromParams = transition.params('from');
        PermTransitionProperties.options = transition.options();
      }
    }
610159
async def _run_state(self, responder, state, trigger, request) \
            -> BaseState:
        

        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
1289183
function handlePeopleRetrieved(state, action) {
  if (action.error) {
    return {
      ...state,
      people: null,
      error: getErrorDescription(action.payload)
    };
  }

  return {
    ...state,
    people: action.payload,
    error: null
  };
}
1260038
function( min, startFunc ) {
		if ( min > render.state ) {
			render._stateError( startFunc || render.requireMinState );
		}
	}
87653
@Override
    public void beforeStep(StepExecution stepExecution) {
        super.beforeStep(stepExecution);

        try {
            new Retrier().execute(new Retriable() {
                /*
                 * (non-Javadoc)
                 *
                 * @see org.duracloud.common.retry.Retriable#retry()
                 */
                @Override
                public Object retry() throws Exception {
                    RestoreStatus newStatus = RestoreStatus.VERIFYING_RETRIEVED_CONTENT;
                    restoreManager.transitionRestoreStatus(restorationId, newStatus, "");
                    return null;
                }
            });
        } catch (Exception ex) {
            addError("failed to transition status to "
                     + RestoreStatus.VERIFYING_RETRIEVED_CONTENT + ": " + ex.getMessage());
            stepExecution.addFailureException(ex);
            failExecution();
        }
    }
851234
private Transition find(String name) {
        for (Transition t : transitions) {
            if (t.getName().matches(name)) {
                return t;
            }
        }
        return null;
    }