UNPKG

@docusign/iam-sdk

Version:

Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@docusign/iam-sdk* API.

72 lines (63 loc) 1.81 kB
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import * as types from "../../types/primitives.js"; import { IamClientError } from "./iamclienterror.js"; /** * The error response object for the Workspaces API */ export type ErrorDetailsData = { /** * A brief message describing the error condition */ message?: string | null | undefined; /** * A standardized code that generalizes the specific error */ errorCode?: string | null | undefined; }; /** * The error response object for the Workspaces API */ export class ErrorDetails extends IamClientError { /** * A standardized code that generalizes the specific error */ errorCode?: string | null | undefined; /** The original data that was passed to this error instance. */ data$: ErrorDetailsData; constructor( err: ErrorDetailsData, httpMeta: { response: Response; request: Request; body: string }, ) { const message = err.message || `API error occurred: ${JSON.stringify(err)}`; super(message, httpMeta); this.data$ = err; if (err.errorCode != null) this.errorCode = err.errorCode; this.name = "ErrorDetails"; } } /** @internal */ export const ErrorDetails$inboundSchema: z.ZodType< ErrorDetails, z.ZodTypeDef, unknown > = z.object({ message: z.nullable(types.string()).optional(), error_code: z.nullable(types.string()).optional(), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { const remapped = remap$(v, { "error_code": "errorCode", }); return new ErrorDetails(remapped, { request: v.request$, response: v.response$, body: v.body$, }); });