-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapierrorinvalidinput.ts
More file actions
85 lines (75 loc) · 2.25 KB
/
apierrorinvalidinput.ts
File metadata and controls
85 lines (75 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod";
import { PetstoreError } from "./petstoreerror.js";
export type ApiErrorInvalidInputData = {
status: number;
error: string;
};
export class ApiErrorInvalidInput extends PetstoreError {
status: number;
error: string;
/** The original data that was passed to this error instance. */
data$: ApiErrorInvalidInputData;
constructor(
err: ApiErrorInvalidInputData,
httpMeta: { response: Response; request: Request; body: string },
) {
const message = "message" in err && typeof err.message === "string"
? err.message
: `API error occurred: ${JSON.stringify(err)}`;
super(message, httpMeta);
this.data$ = err;
this.status = err.status;
this.error = err.error;
this.name = "ApiErrorInvalidInput";
}
}
/** @internal */
export const ApiErrorInvalidInput$inboundSchema: z.ZodType<
ApiErrorInvalidInput,
z.ZodTypeDef,
unknown
> = z.object({
status: z.number().int(),
error: z.string(),
request$: z.instanceof(Request),
response$: z.instanceof(Response),
body$: z.string(),
})
.transform((v) => {
return new ApiErrorInvalidInput(v, {
request: v.request$,
response: v.response$,
body: v.body$,
});
});
/** @internal */
export type ApiErrorInvalidInput$Outbound = {
status: number;
error: string;
};
/** @internal */
export const ApiErrorInvalidInput$outboundSchema: z.ZodType<
ApiErrorInvalidInput$Outbound,
z.ZodTypeDef,
ApiErrorInvalidInput
> = z.instanceof(ApiErrorInvalidInput)
.transform(v => v.data$)
.pipe(z.object({
status: z.number().int(),
error: z.string(),
}));
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace ApiErrorInvalidInput$ {
/** @deprecated use `ApiErrorInvalidInput$inboundSchema` instead. */
export const inboundSchema = ApiErrorInvalidInput$inboundSchema;
/** @deprecated use `ApiErrorInvalidInput$outboundSchema` instead. */
export const outboundSchema = ApiErrorInvalidInput$outboundSchema;
/** @deprecated use `ApiErrorInvalidInput$Outbound` instead. */
export type Outbound = ApiErrorInvalidInput$Outbound;
}