Error Handling
All SDK methods throw typed errors on failure. Every error class extends MemsolusError, so you can catch all SDK errors with a single instanceof check or handle specific cases individually.
Error hierarchy
Error classes
MemsolusError
Base class for all SDK errors. Always available as a fallback.
NotFoundError
Thrown when the requested resource does not exist or does not belong to the current workspace.
ValidationError
Thrown when the request payload fails validation. The code field identifies which field or rule failed.
QuotaExceededError
Thrown when a plan quota is reached. The resource field identifies which limit was hit, and limit and used show the current usage.
UnauthorizedError
Thrown when the API key is missing, expired, or invalid.
ForbiddenError
Thrown when the API key does not have permission for the requested operation.
ConflictError
Thrown when the request conflicts with the current state of a resource.
TimeoutError
Thrown when the request exceeds the configured timeout.
NetworkError
Thrown when the request fails due to a network issue (no connection, DNS failure, etc.).
Automatic retry
The SDK automatically retries requests that fail with 503 (service unavailable) by default. Configure retry behavior when initializing the client:
Retries use linear backoff: if backoffMs is 1000, the delays are 1s, 2s, 3s. To disable retries entirely, set maxAttempts: 1.
Complete error handling example
Related
- Getting Started — client initialization and retry configuration
- Type Reference —
MemsolusErrorand all error class definitions - API Reference — API key scopes and permissions