JavaScript & TypeScript
Error Handling
Learn how to handle errors in the Itzam SDK
Error Handling
The Itzam SDK provides a robust error handling system that helps you handle different types of errors that may occur during API calls. All errors thrown by the SDK extend from the base ItzamError
class.
Error Types
ItzamError
The base error class that all other error types extend from. Contains common properties shared across all error types.
ItzamAuthenticationError
Thrown when there’s an authentication issue (HTTP 401).
ItzamValidationError
Thrown when the request is invalid (HTTP 400).
ItzamNotFoundError
Thrown when a requested resource is not found (HTTP 404).
ItzamServerError
Thrown when there’s a server-side error (HTTP 500).
Handling Multiple Error Types
You can handle multiple error types in a single try-catch block: