Syntax

Platform.Function.RaiseError(message[, currentRecipientOnly[, errorCode[, errorNumber]]])
1–4 arguments

Parameters

Name Type Required Description
message string Yes Message describing the error
currentRecipientOnly boolean No When true, the error applies only to the current recipient. When false, the entire send job stops.
errorCode string No Short user-defined code identifying the error type
errorNumber number No User-defined numeric error code for reference

Examples

// Halt with an error
var email = Platform.Function.Lookup("Contacts", "email", "id", contactId);
if (!email) {
    Platform.Function.RaiseError("No email found for contact: " + contactId);
}

// In email send: skip rather than bounce
var pref = Platform.Function.Lookup("Preferences", "optIn", "id", subscriberId);
if (pref !== "yes") {
    Platform.Function.RaiseError("Subscriber opted out.", true);
}

Notes

In email sends:

  • RaiseError(msg, false) — causes a hard bounce for this subscriber
  • RaiseError(msg, true) — skips this subscriber silently without bouncing

For CloudPage error handling in a try/catch, use throw instead so execution can be caught and recovered. RaiseError always terminates execution.

See Also

See Also