Altova FlowForce Server 2025 

This expression function produces a result object with empty stdout and stderr, the exit code as specified (the default value is 1, which represents an error), and the error message as specified (the default value is an empty string) and no result files. The make-error-result function is used in Resume steps. For details, see Resume Steps.

 

Signature

make-error-result (exit-code:number=1, error-message:string="") -> result

 

Example

This example shows how the make-error-result function can be used in a job. The sample job illustrated below consists of an Error/Success-Handling block that executes a MapForce mapping and an Execution step that computes an expression. In the Error/Success-Handling block, there is also an On-Error handler that contains a Resume step. In case an error occurs during mapping execution, we do not want the job to fail. Therefore, we proceed as follows:

 

1.We define a Resume step that will replace the result of the failed protected step with a newly constructed result object and set the result of the protected block to the computed expression.

2.We also want to use the result of the make-error-result function in the next step, by assigning it to Map.

3.In the next step, we extract the exit code and the error message from Map with the following expression for the compute-string function: {string(exitcode(Map))}, {error-message(Map)}. This expression converts the exit code to a string and concatenates this string with the error message. The values of the exit code and the error message are the arguments passed to the make-error-result function in the Resume step.

 

Our sample job is configured as a Web service. If an error occurs, the browser window will display the following result:

 

1, Mapping has failed!

 

If you do not want to access the expression computed in the Resume step, you do not need to assign the step's result to anything. Instead, you can add any step(s) outside the Error/Success-Handling step. The new step(s) will be processed after the Resume step has been executed.

ffs_makeerrorresultexample_zoom70

© 2018-2024 Altova GmbH