Contact Free trial Login


failIf(T, (value: T) -> Boolean, String): T

Produces an error with the specified message if the expression in the evaluator returns true, otherwise returns the value.


Name Description


The value to return only if the evaluator expression is false.


Expression that returns true or false.


This example produces a runtime error (instead of a SUCCESS message) because the expression isEmpty(result) is true. It is true because an empty object is passed through variable result.


%dw 2.0
import failIf from dw::Runtime
var result = {}
output application/json
{ "result" : "SUCCESS" failIf (isEmpty(result)) }


ERROR 2018-07-29 11:56:39,988 ...
Message               : "Failed

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.