src/com/facebook/buck/step/StepFailedException.java
/** Creates a StepFailedException based on a StepExecutionResult. */
Creates a StepFailedException based on a StepExecutionResult.
Creates a StepFailedException based on a StepExecutionResult .
public static StepFailedException createForFailingStepWithExitCode(
      Step step, ExecutionContext context, StepExecutionResult executionResult) {
    int exitCode = executionResult.getExitCode();
    StringBuilder messageBuilder = new StringBuilder();
    messageBuilder.append(String.format("Command failed with exit code %d.", exitCode));
    ImmutableList<String> executedCommand = executionResult.getExecutedCommand();
    if (!executedCommand.isEmpty()) {
      messageBuilder.append(System.lineSeparator()).append("command: ").append(executedCommand);
    }
    executionResult
        .getStderr()
        .ifPresent(
            stderr ->
                messageBuilder.append(System.lineSeparator()).append("stderr: ").append(stderr));
    return createForFailingStepWithException(
        step, context, new HumanReadableException(messageBuilder.toString()));
  }
public static StepFailedException createForFailingStepWithExitCode ( Step step , ExecutionContext context , StepExecutionResult executionResult ) { int exitCode = executionResult . getExitCode ( ) ; StringBuilder messageBuilder = new StringBuilder ( ) ; messageBuilder . append ( String . format ( "Command failed with exit code %d." , exitCode ) ) ; ImmutableList < String > executedCommand = executionResult . getExecutedCommand ( ) ; if ( ! executedCommand . isEmpty ( ) ) { messageBuilder . append ( System . lineSeparator ( ) ) . append ( "command: " ) . append ( executedCommand ) ; } executionResult . getStderr ( ) . ifPresent ( stderr -> messageBuilder . append ( System . lineSeparator ( ) ) . append ( "stderr: " ) . append ( stderr ) ) ; return createForFailingStepWithException ( step , context , new HumanReadableException ( messageBuilder . toString ( ) ) ) ; }
Creates a StepFailedException based on a StepExecutionResult.
Creates a StepFailedException based on a StepExecutionResult .