Syntax

Platform.Function.RaiseError(errorMessage [, skipOnError [, sourceType, sourceID]])
1–4 arguments

Parameters

Name Type Required Description
errorMessage string Yes Message describing the error
skipOnError boolean No When true, skips the send record rather than causing a hard bounce (email send context). Default: false
sourceType string No Source type identifier for logging
sourceID string No Source ID for logging

Examples

// Halt with an error
var email = Platform.Function.Lookup("Contacts", "email", "id", contactId);
if (Platform.Function.Empty(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