Overview
All errors thrown by the SDK extend fromGrantexError. The hierarchy is designed so you can catch errors at different levels of specificity.
Error hierarchy
GrantexError
The base error class. All SDK errors are instances ofGrantexError.
GrantexApiError
Thrown when the Grantex API returns an HTTP error response (4xx or 5xx). ExtendsGrantexError.
GrantexAuthError
Thrown for authentication and authorization failures (HTTP 401 or 403). ExtendsGrantexApiError.
Inherits all properties from
GrantexApiError.
GrantexTokenError
Thrown when offline token verification fails. This error is raised byverifyGrantToken() and grants.verify(). Extends GrantexError.
- Invalid JWT signature
- Expired token
- Missing required JWT claims
- Missing required scopes (when
requiredScopesis specified) - Audience mismatch (when
audienceis specified)
GrantexNetworkError
Thrown when a network error occurs (timeout, DNS resolution failure, connection refused). ExtendsGrantexError.