The functions described here are packaged in the Runtime module. The module is included with Mule runtime, but you must import it to your DataWeave code by adding the line import dw::Runtime to your header.

Example
%dw 2.0
import dw::Runtime
---
Runtime::fail("Error")

This module contains functions that allow you to interact with the DataWeave engine.

Functions

Fail

fail(String): Nothing

Throws an exception with the specified message.

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

Try

try(() → T): TryResult<T>

Wait

wait(T, Number): T

Stops the execution for the specified timeout (in milliseconds).

Types

TryResult

Evaluates the delegate and returns an object with the result or an error message.

  1. Definition

{ success: Boolean, result?: T, error?: { kind: String, message: String, stack?: Array<String>, location?: String } }