Error class hierarchy
The Mandate SDK throws 5 typed error classes. Every error extendsMandateError, which extends the native Error. Use instanceof to handle each scenario precisely.
@mandate.md/sdk. Import them in a single statement:
Catching errors with instanceof
Order matters. Check specific subclasses before the baseMandateError. Here is the complete pattern:
What to do for each error
Block reason reference
When aPolicyBlockedError fires, the blockReason field tells you exactly which check failed. Here are the most common values:
See Block Reasons Reference for the full list of all reason codes.
Retry strategy
Not all errors are retryable. Follow these rules to avoid wasting cycles or triggering rate limits.Fail-safe rules
If the Mandate API is unreachable, your agent must block the transaction. Never fall back to unvalidated execution. A network failure is not permission to skip validation. Treat an unreachable API the same as a rejection.Next Steps
Error Classes Reference
Full property tables and code examples for all 5 error classes.
Block Reasons
Complete list of blockReason codes, meanings, and recommended actions.
Validate Transactions
Step-by-step guide to calling validate() in your agent code.
Common Errors
Troubleshoot frequent issues with error codes and solutions.