Errors
The raw client throws typed errors. All of them extend SdkError. Session actions never throw: they put these same errors in state.
SdkError├── NetworkError├── TimeoutError├── AbortError├── AffordanceUnavailableError└── ApiError ├── UnauthorizedError 401 ├── NotFoundError 404 ├── ValidationError 422 └── ServerError 5xx └── QuoteFailedErrorReference
Section titled “Reference”SdkError
Section titled “SdkError”requestId: the request’s correlation id. Quote it to support.attempts: how many attempts were made.cause: the underlying error.
NetworkError, TimeoutError, AbortError
Section titled “NetworkError, TimeoutError, AbortError”The request didn’t complete: the network failed, a timeout passed, or you aborted with a signal.
AffordanceUnavailableError
Section titled “AffordanceUnavailableError”The server didn’t offer the link or template the call needs. For example, quote.select() on a referred quote.
ApiError
Section titled “ApiError”A non-2xx response.
status: the HTTP status.body: the parsed body.retryAfterMs: fromRetry-After, when sent.
QuoteFailedError
Section titled “QuoteFailedError”The quote set failed. Extends ServerError.
retry(options?): re-queue quoting. Returns a fresh questionnaire.amend: the questionnaire’s amend link.
Helpers
Section titled “Helpers”isSdkError(e),isApiError(e): type guards.
import { isApiError, QuoteFailedError, UnauthorizedError } from '@partner-sdk/core';
try { const quoteSet = await q.quotes.wait();} catch (e) { if (e instanceof QuoteFailedError) { const retried = await e.retry(); } else if (e instanceof UnauthorizedError) { // check your API key } else if (isApiError(e)) { log('quote error', e.status, e.requestId); // never log answers } else { throw e; }}