/** * WorkOS-specific error types. * * Re-exports the common HTTP errors from core and adds the WorkOS-specific * unknown-error and parse-error wrappers (ported from distilled v0). */ export { BadGateway, BadRequest, Conflict, ConfigError, Forbidden, GatewayTimeout, InternalServerError, Locked, NotFound, ServiceUnavailable, TooManyRequests, Unauthorized, UnprocessableEntity, HTTP_STATUS_MAP, DEFAULT_ERRORS, API_ERRORS, } from "@distilled.cloud/core/errors"; import * as Category from "@distilled.cloud/core/category"; import type { DefaultErrors as CoreDefaultErrors } from "@distilled.cloud/core/errors"; import * as Schema from "@distilled.cloud/core/schema-lite-typed"; /** * Unknown WorkOS error -- returned when a failed response's HTTP status has no * mapped error class. Carries the raw body for later cataloging. */ export class UnknownWorkosError extends /*@__PURE__*/ Schema.TaggedError()("UnknownWorkosError", { code: /*@__PURE__*/ Schema.optional(Schema.String), message: /*@__PURE__*/ Schema.optional(Schema.String), body: Schema.Unknown, }).pipe(Category.withServerError) {} /** Schema parse error wrapper. */ export class WorkosParseError extends /*@__PURE__*/ Schema.TaggedError()("WorkosParseError", { body: Schema.Unknown, cause: Schema.Unknown, }).pipe(Category.withParseError) {} /** * Errors any WorkOS operation may surface in addition to the per-operation * typed status errors. */ export type ClientErrors = UnknownWorkosError | WorkosParseError; /** * Default WorkOS operation errors: the shared HTTP status errors from core * plus the client-level fallback/decode errors. */ export type DefaultErrors = CoreDefaultErrors | ClientErrors;