@docusign/iam-sdk
Version:
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@docusign/iam-sdk* API.
41 lines • 1.4 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 { IamClientError } from "./iamclienterror.js";
export class OAuthErrorResponse 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;
if (err.error != null)
this.error = err.error;
if (err.errorDescription != null) {
this.errorDescription = err.errorDescription;
}
this.name = "OAuthErrorResponse";
}
}
/** @internal */
export const OAuthErrorResponse$inboundSchema = z.object({
error: z.nullable(types.string()).optional(),
error_description: z.nullable(types.string()).optional(),
request$: z.instanceof(Request),
response$: z.instanceof(Response),
body$: z.string(),
})
.transform((v) => {
const remapped = remap$(v, {
"error_description": "errorDescription",
});
return new OAuthErrorResponse(remapped, {
request: v.request$,
response: v.response$,
body: v.body$,
});
});
//# sourceMappingURL=oautherrorresponse.js.map