Altova FlowForce Server 2025 

Returns the result of a failed execution step. Using this function is meaningful when you are handling errors with protected blocks, as described in Handling Step Errors. The failed-step function must be part of the "On error" handler; otherwise, the step where you are using it will fail because there is no erroneous step.

 

This function returns a value of type result that represents the result of the erroneous step. To find the result's attributes, pass this function as argument to expression functions such as stdout or stderr, for example:

 

stderr(failed-step())

stdout(failed-step())

 

Whether you should use stderr or stdout depends on whether the failing step returns the error information in the standard error or standard output streams, respectively.

 

Signature

failed-step() -> result

 

Examples

The job illustrated below uses error handling, so it qualifies for a call to the failed-step function. The first execution step attempts to run a shell command which is supplied as a job input parameter. If the command fails with an error, the "On error" handler will be executed. The first and only step of the "On Error" handler calls an error handling sub-job which was created separately and is discussed below.

fs-failed-step-example-01

Although you can configure your error handling differently, the error-handling sub-job in this example takes two input parameters:

 

1.inputResult - the output of the failed-step function, of type result.

2.workingDirectory - the directory to which the log file containing the error details will be written.

 

The error handling sub-job looks as follows:

fs-failed-step-example-02

The execution step above invokes the copy function in order to create a file called error.log in the job's working directory. The expression from the Source text box does the following:

 

1.The stderr expression function converts the standard error provided by inputResult to a stream. As mentioned above, in some cases, you might need to use stdout instead of stderr. Both stdout and stderr take a value of type result as argument. That's precisely the return type produced by the failed-step function (which in this example was called in the main job).

2.The as-file function converts the stream to a file and writes it to the disk. The path of the file is relative to the working directory.

 

For more examples, see:

 

Add Error Handling to a Job

Validate an XML Document with Error Logging

© 2018-2024 Altova GmbH