Error function

About Error function

You use the Error function to create errors in Control or Modify rules.

newError(code, message, args)


Creates a new business error and adds it to the error list returned by the rule-based function.

Syntax newError(code, message, args)



code: Business error code.

message: Business error message (used if the error code is not found in the dictionary).

args: Variable number of message arguments.


The following example assigns variables to the properties so that the properties of the new element can be read or set.

if PROP1 is null then

err = newError(“nullProperty”, “property PROP1 is null”)

err.field = “PROP1”

err.customProp1 = “p1”

The following example that uses placeholders and arguments returns a business error with the message: “p1 = 10, p2 = 20”.

newError(“err.code”, “p1 = {0}, p2 = {1}”, 10, 20).

Related Links