Ir al contenido

Errors

Esta página aún no está disponible en tu idioma.

Class@tryyoursize/node

Every error of an API call is a TryYourSizeError subclass, by HTTP status: InvalidRequestError (400, 422), AuthenticationError (401), PermissionError (403), NotFoundError (404), ConflictError (409), RateLimitError (429, with retryAfter), APIError (5xx) and ConnectionError (no answer). Webhook checks throw SignatureVerificationError.

class TryYourSizeError extends Error
statusnumber | undefinedObligatorio
codestring | undefinedObligatorio
docUrlstring | undefinedObligatorio
requestIdstring | undefinedObligatorio
rawunknownObligatorio
headersHeaders | undefinedObligatorio
issuesGarmentIssue[] | undefinedObligatorio

Values to fix, for 422 answers of the garment endpoints (schema GarmentRejected).

import { TryYourSizeError, RateLimitError } from "@tryyoursize/node";
try {
await tys.products.retrieve("NO-SUCH-SKU");
} catch (err) {
if (err instanceof RateLimitError) await sleep((err.retryAfter ?? 1) * 1000);
else if (err instanceof TryYourSizeError) console.error(err.status, err.code, err.requestId);
}

¿Te ha resultado útil esta página?