Handlebars raiseError
Handlebars raiseError: throws an exception with a message and optional error code, halting rendering.
Next
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
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
- AMPscript
RaiseError— does a similar job in AMPscript, with a different call shape - Official reference