Error handling
SelfApiError
SelfApiErrorimport { SelfApiError } from '@selfxyz/enterprise-sdk';
try {
await self.sessions.create({ flowId, externalUuid });
} catch (err) {
if (err instanceof SelfApiError) {
err.statusCode; // number (HTTP status)
err.code; // string ('validation_failed', 'not_found', 'unauthenticated', ...)
err.message; // string (human-readable)
err.details; // Record<string, unknown> | undefined
err.requestId; // string | undefined (X-Request-Id; quote it to support)
} else {
throw err; // network error, or something unexpected
}
}Switching on the error
Error codes
SelfValidationError
SelfValidationErrorWebhookVerificationError
WebhookVerificationErrorRetries
Logging
Related
Last updated