Get the reasons to finalize the flow.

@param reason the reason
@param originalError the original error
@return the reasons to finalize the flow
189765
public static String[] getFinalizeFlowReasons(final String reason, final Throwable
      originalError) {
    final List<String> reasons = new LinkedList<>();
    reasons.add(reason);
    if (originalError != null) {
      reasons.add(ExceptionUtils.getStackTrace(originalError));
    }
    return reasons.toArray(new String[reasons.size()]);
  }
892422
def _get_error_reason(response):
        
        try:
            body = response.json()
            if body and 'reason' in body:
                return body['reason']
        except ValueError:
            pass
        return response.content
150
@Override
  public List<ExecutableFlow> getRunningFlows() {
    final ArrayList<ExecutableFlow> flows = new ArrayList<>();
    try {
      getFlowsHelper(flows, this.executorLoader.fetchUnfinishedFlows().values());
    } catch (final ExecutorManagerException e) {
      logger.error("Failed to get running flows.", e);
    }
    return flows;
  }
866070
@Override
  public void internalError(final Exception cause) {
    logError("Internal Server Error on " + request().getUri(), cause);

    if (this.api_version > 0) {
      // always default to the latest version of the error formatter since we
      // need to return something
      switch (this.api_version) {
        case 1:
        default:
          sendReply(HttpResponseStatus.INTERNAL_SERVER_ERROR,
              serializer.formatErrorV1(cause));
      }
      return;
    }

    ThrowableProxy tp = new ThrowableProxy(cause);
    tp.calculatePackagingData();
    final String pretty_exc = ThrowableProxyUtil.asString(tp);
    tp = null;
    if (hasQueryStringParam("json")) {
      // 32 = 10 + some extra space as exceptions always have \t's to escape.
      final StringBuilder buf = new StringBuilder(32 + pretty_exc.length());
      buf.append("{\"err\":\"");
      HttpQuery.escapeJson(pretty_exc, buf);
      buf.append("\"}");
      sendReply(HttpResponseStatus.INTERNAL_SERVER_ERROR, buf);
    } else {
      sendReply(HttpResponseStatus.INTERNAL_SERVER_ERROR,
                makePage("Internal Server Error", "Houston, we have a problem",
                         "<blockquote>"
                         + "<h1>Internal Server Error</h1>"
                         + "Oops, sorry but your request failed due to a"
                         + " server error.<br/><br/>"
                         + "Please try again in 30 seconds.<pre>"
                         + pretty_exc
                         + "</pre></blockquote>"));
    }
  }
1135806
@SuppressWarnings({"UnusedDeclaration"})
    protected Closure resolveExplicitMethod(String methodName, Object args) {
        return getExplicitMethods().get(methodName);
    }
1369120
public void abort(CheckpointFailureReason reason, Throwable cause) {
		try {
			CheckpointException exception = new CheckpointException(reason, cause);
			onCompletionPromise.completeExceptionally(exception);
			reportFailedCheckpoint(exception);
			assertAbortSubsumedForced(reason);
		} finally {
			dispose(true);
		}
	}
740030
protected void beforeRestart(final Throwable reason) {
    // override for specific recovery

    logger().log("Default before restart recovery after: " + reason.getMessage(), reason);

    lifeCycle.afterStop(this);
  }
1156165
public static Optional<SaltError> deriveError(String saltOutput) {
        Matcher fnuMatcher = FN_UNAVAILABLE.matcher(saltOutput);
        Matcher mnsMatcher = MODULE_NOT_SUPPORTED.matcher(saltOutput);
        if (fnuMatcher.find()) {
            String fn = fnuMatcher.group(1);
            return Optional.of(new FunctionNotAvailable(fn));
        } else if (mnsMatcher.find()) {
            String module = mnsMatcher.group(1);
            return Optional.of(new ModuleNotSupported(module));
        }
        return Optional.empty();
    }
638570
public static SpecificErrorCondition getSpecificErrorCondition(StanzaError error) {
        // This method is implemented to provide an easy way of getting a packet
        // extension of the XMPPError.
        for (SpecificErrorCondition condition : SpecificErrorCondition.values()) {
            if (error.getExtension(condition.toString(),
                    AdHocCommandData.SpecificError.namespace) != null) {
                return condition;
            }
        }
        return null;
    }
524899
@SuppressWarnings({ "rawtypes", "unchecked" })
  public <T extends AbstractFlowNodeBuilder> T errorEventDefinitionDone() {
    return (T) ((Event) element.getParentElement()).builder();
  }
776060
protected boolean overrideFinalize(MethodBodyCreator creator) {
        Method finalize = null;
        final ClassMetadataSource data = reflectionMetadataSource.getClassMetadata(Object.class);
        try {
            finalize = data.getMethod("finalize", void.class);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return overrideMethod(finalize, MethodIdentifier.getIdentifierForMethod(finalize), creator);
    }
686791
public String reason() {
        Description description = new StringDescription();
        condition.describeDissatisfactionTo(description);
        return description.toString();
    }
496843
public java.util.List<String> getFlowLogIds() {
        if (flowLogIds == null) {
            flowLogIds = new com.amazonaws.internal.SdkInternalList<String>();
        }
        return flowLogIds;
    }
469690
public com.google.api.ads.admanager.axis.v201902.CreativePreviewErrorReason getReason() {
        return reason;
    }
120913
@Override
  public List<Integer> getRunningFlows(final int projectId, final String flowId) {
    final List<Integer> executionIds = new ArrayList<>();
    try {
      executionIds.addAll(getRunningFlowsHelper(projectId, flowId,
          this.executorLoader.fetchUnfinishedFlows().values()));
    } catch (final ExecutorManagerException e) {
      logger.error("Failed to get running flows for project " + projectId + ", flow "
          + flowId, e);
    }
    return executionIds;
  }
212464
private int getPriority(final ExecutableFlow exflow) {
    final ExecutionOptions options = exflow.getExecutionOptions();
    int priority = ExecutionOptions.DEFAULT_FLOW_PRIORITY;
    if (options != null
        && options.getFlowParameters() != null
        && options.getFlowParameters()
        .containsKey(ExecutionOptions.FLOW_PRIORITY)) {
      try {
        priority =
            Integer.valueOf(options.getFlowParameters().get(
                ExecutionOptions.FLOW_PRIORITY));
      } catch (final NumberFormatException ex) {
        priority = ExecutionOptions.DEFAULT_FLOW_PRIORITY;
        logger.error(
            "Failed to parse flow priority for exec_id = "
                + exflow.getExecutionId(), ex);
      }
    }
    return priority;
  }
1094970
LinkedHashMap/*< String, SharedFlowController >*/ getDefaultSharedFlows( RequestContext context )
            throws ClassNotFoundException, InstantiationException, IllegalAccessException
    {
        SharedFlowRefConfig[] defaultRefs = ConfigUtil.getConfig().getSharedFlowRefs();

        if ( defaultRefs != null )
        {
            if ( defaultRefs.length > 0 )
            {
                LinkedHashMap/*< String, SharedFlowController >*/ sharedFlows = new LinkedHashMap();

                for ( int i = 0; i < defaultRefs.length; i++ )
                {
                    SharedFlowRefConfig ref = defaultRefs[i];
                    if ( LOG.isInfoEnabled() )
                    {
                        LOG.info( "Shared flow of type " + ref.getType() + " is a default shared flow reference "
                                    + "with name " + ref.getName() );
                    }
                    addSharedFlow( context, ref.getName(), ref.getType(), sharedFlows );
                }

                return sharedFlows;
            }
        }

        return null;
    }