Verification in progress Test scripts included

Throws an exception with a message and optional error code, halting rendering.

Syntax

{{raiseError errorMessage [errorCode]}}

Parameters

Name Type Required Description
errorMessage string Yes The error message to include.
errorCode string No An error code for categorizing the error.

Example

Tested in a Marketing Cloud Next email on 2026-11-22:

  • {{#if false}}{{raiseError "Stopped"}}{{/if}} is accepted when the email is saved. The branch never runs, so the helper itself is not rendered.
Show Next test script
<!-- Marketing Cloud Next test script for the raiseError helper. Paste it into the HTML component of a
     Next email and open the preview. Each line prints the result Next gave when the call
     was rendered on its own (expect) next to the result of this run (got).
     Assembled from single-call test emails (dates on the page); it has not been
     run as one email. Calls that make Next fail are listed separately. -->
<p>c1 expect=[gated] got=[{{#if false}}{{raiseError "probe"}}{{/if}}gated]</p>

Marketing Cloud Next

Not runtime-tested in Marketing Cloud Next yet

Accepted when the email is saved, but not rendered yet: it always stops the render, so it needs an email of its own and could not share one with the other tests. Tested 2026-11-22 by rendering in a Marketing Cloud Next email.

See also