Catch Block — Configuration
The optional error_variable_prefix property and variable naming conventions for nested catch blocks.
Properties Reference
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
error_variable_prefix |
string | Optional | "__exception" |
The prefix used for the three exception memory variables injected by the catch handler. By default, variables are named __exception_type__, __exception_message__, and __exception_stacktrace__. Changing this prefix generates differently named variables — useful for distinguishing inner and outer catch scopes in nested try/catch patterns. |
Default Variable Names
With the default prefix (__exception), the following memory variables are populated on catch:
| Memory Variable | Type | Content |
|---|---|---|
$mem.__exception_type__ |
string | The .NET exception class name (e.g., HttpRequestException, TimeoutException, ArgumentNullException) |
$mem.__exception_message__ |
string | The exception's human-readable message property |
$mem.__exception_stacktrace__ |
string | The full .NET stack trace string for debugging and log submission |
Sample Configuration JSON
Default configuration (no prefix customisation needed in most cases):
{
"nodeType": "CatchBlock",
"id": "catch_payment_api",
"label": "Catch — Payment API Errors"
}
With a custom prefix for nested catch disambiguation:
{
"nodeType": "CatchBlock",
"id": "catch_inner_email",
"label": "Catch — Email Send Errors",
"config": {
"error_variable_prefix": "__email_error"
}
}
With the custom prefix __email_error, the variables become:
$mem.__email_error_type__$mem.__email_error_message__$mem.__email_error_stacktrace__
Nested catch variable conflicts: When using nested try/catch blocks, always use a custom
error_variable_prefix on the inner catch block. If both inner and outer catch blocks use the default __exception prefix, the inner catch's variables will overwrite the outer catch's variables in shared memory scope, making it impossible to distinguish which exception is being handled.
Common Exception Types
The following exception types are commonly encountered in BizFirstAI workflows:
| Exception Type | Typical Cause | Recommended Handling |
|---|---|---|
HttpRequestException |
External API call failed (network error, non-2xx response) | Retry with backoff, log to error channel, use cached data |
TimeoutException |
External service did not respond within configured timeout | Retry once, then fallback or alert team |
KeyNotFoundException |
Expected dictionary key or map field was absent | Set default value, log warning, continue |
ArgumentNullException |
A required expression resolved to null | Log data quality issue, skip record, alert data team |
UnauthorizedException |
API credentials expired or invalid | Trigger credential refresh workflow, alert admin |