Free MuleSoft CONNECT Keynote & Expo Pass Available!

Register now+
Nav

failIf

failIf(T, (value: T) → Boolean, String): T

Throws an exception with the specified message if the expression in the evaluator returns true. If not, return the value.

Example

        
     
1
2
3
4
5
%dw 2.0
import failIf from dw::Runtime
output application/json
---
{ "a" : "b" } failIf ("b" is String)
Output
Failed