Handlebar Helper Function: RaiseError

Throws an exception with a specified error message and optional error code. Use this helper to interrupt template rendering when you need to enforce validation rules or signal error states. When this helper executes, it prevents the template from completing. Consuming services can access the error details.

This helper is available in the Summer ’26 release of Marketing Cloud Next (API version 67.0).

ParameterTypeDescription
errorMessageStringRequired. The error message to include in the exception.
errorCodeStringAn error code for categorizing or programmatically identifying errors.

This helper always throws a RaiseErrorHelperException that contains the provided message and optional error code.

The exception that this helper throws can’t be caught or handled by the fallback helper.

Use this helper alone or with conditional logic. This example shows the function within an if-else block.