N NezamDocumentation

Error grammar#

Error grammar is the compatibility module for error declarations and imported error handling behavior.

Source#

PropertyValue
Grammar filepackages/business/language/grammar/error.g4
Grammar nameerror
Grammar kindparser
Importscommon
Imported byBusinessLanguage, module
Direct rule or token count1

How to use this page#

Read the examples first when authoring Business Language. Use the rule inventory when checking exact grammar coverage or when updating parser, lowering, editor, or documentation behavior.

Entry rules and syntax families#

Start with these rules when reading this grammar: errorDeclaration.

  • Declarations: errorDeclaration

Key grammar excerpts#

errorDeclaration#

antlr
errorDeclaration
    : ERROR identifier SEMICOLON
    ;

Complete rule and token inventory#

text
errorDeclaration

Examples#

Declared error reference#

bl
error MissingApprovalPolicy;

function require_policy(): bool {
  raise MissingApprovalPolicy;
}

Error declaration shell#

bl
error DuplicateInvoice;

Common authoring mistakes#

  • Do not copy examples without checking the rule inventory for the exact grammar boundary.
  • Do not add behavior that depends on missing configuration or undeclared user-facing errors.
  • /language/messages-errors/
  • /language/rules-tests-errors/

Authoring notes#

  • Keep examples aligned with the grammar source, not with inferred syntax from another language.
  • Use declared messages for user-facing failures, and fail closed when required configuration is absent.
Source: packages/business/language/grammar-files/error.md