Error grammar#
Error grammar is the compatibility module for error declarations and imported error handling behavior.
Source#
| Property | Value |
|---|---|
| Grammar file | packages/business/language/grammar/error.g4 |
| Grammar name | error |
| Grammar kind | parser |
| Imports | common |
| Imported by | BusinessLanguage, module |
| Direct rule or token count | 1 |
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#
errorDeclaration
: ERROR identifier SEMICOLON
;Complete rule and token inventory#
errorDeclarationExamples#
Declared error reference#
error MissingApprovalPolicy;
function require_policy(): bool {
raise MissingApprovalPolicy;
}Error declaration shell#
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.
Related guides#
- /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.