@docusign/iam-sdk
Version:
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@docusign/iam-sdk* API.
62 lines • 2.07 kB
JavaScript
/*
* 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 * as components from "../components/index.js";
import { IamClientError } from "./iamclienterror.js";
/**
* Error response conforming to RFC 9457 (Problem Details for HTTP APIs).
*
* @remarks
* See: https://www.rfc-editor.org/rfc/rfc9457.html
*/
export class ErrDetails extends IamClientError {
constructor(err, httpMeta) {
const message = "message" in err && typeof err.message === "string"
? err.message
: `API error occurred: ${JSON.stringify(err)}`;
super(message, httpMeta);
this.data$ = err;
this.type = err.type;
this.title = err.title;
this.status = err.status;
if (err.detail != null)
this.detail = err.detail;
if (err.instance != null)
this.instance = err.instance;
if (err.errors != null)
this.errors = err.errors;
if (err.requestId != null)
this.requestId = err.requestId;
if (err.timestamp != null)
this.timestamp = err.timestamp;
this.name = "ErrDetails";
}
}
/** @internal */
export const ErrDetails$inboundSchema = z.object({
type: types.string(),
title: types.string(),
status: types.number(),
detail: types.optional(types.string()),
instance: types.optional(types.string()),
errors: types.optional(z.array(components.ValidationError$inboundSchema)),
request_id: types.optional(types.string()),
timestamp: types.optional(types.date()),
request$: z.instanceof(Request),
response$: z.instanceof(Response),
body$: z.string(),
})
.transform((v) => {
const remapped = remap$(v, {
"request_id": "requestId",
});
return new ErrDetails(remapped, {
request: v.request$,
response: v.response$,
body: v.body$,
});
});
//# sourceMappingURL=errdetails.js.map