How it works
- Classification: Grat extracts the
TransactionResultand identifies the specific error code. - Taxonomy Lookup: It maps the code to our Error Taxonomy, which contains detailed explanations for every host error.
- Contract Resolution: If the error is a custom contract error (
Error(Contract, #N)), Grat:- Fetches the contract’s WASM bytecode from the ledger.
- Parses the
contractspecv0custom section. - Cross-references the error index with the defined enum names and doc comments.
Contract-Specific Metadata
Grat resolves#3 into InsufficientBalance because it understands the contract’s metadata structure. This turns a generic number into a business-logic error that you can fix instantly.
Plain-English Error Summaries
EveryHostError exposes a summary() method that returns a single sentence
describing what went wrong. This is the first line a developer sees when
running grat decode — written to immediately answer “what went wrong?” without
requiring knowledge of Soroban internals.
Examples
All summaries are kept under 120 characters and avoid technical jargon where possible.
For unknown codes within known categories, a formatted fallback is returned so no
error is ever left unexplained.