@hey-api/openapi-ts 0.87.2 → 0.87.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/clients/fetch/client.ts +34 -1
- package/dist/{config-CQeoZYf_.d.cts → config-CK1EGY2d.d.cts} +1021 -6
- package/dist/{config-U5JEpxGS.d.ts → config-DHUTNwtw.d.ts} +1021 -6
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +325 -325
- package/dist/index.d.ts +325 -325
- package/dist/index.js +1 -1
- package/dist/internal.cjs +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/dist/openApi-BKUOqJVi.cjs +19 -0
- package/dist/openApi-BKUOqJVi.cjs.map +1 -0
- package/dist/openApi-QNcKaSPP.js +19 -0
- package/dist/openApi-QNcKaSPP.js.map +1 -0
- package/dist/run.cjs +1 -1
- package/dist/run.cjs.map +1 -1
- package/dist/run.js +1 -1
- package/dist/run.js.map +1 -1
- package/dist/src-D4L_i8zt.js +11 -0
- package/dist/{src-Ba-zyEiS.js.map → src-D4L_i8zt.js.map} +1 -1
- package/dist/src-DmdEIcct.cjs +19 -0
- package/dist/{src-CNO_U6s-.cjs.map → src-DmdEIcct.cjs.map} +1 -1
- package/package.json +2 -2
- package/dist/openApi-CT-iM-D8.cjs +0 -19
- package/dist/openApi-CT-iM-D8.cjs.map +0 -1
- package/dist/openApi-HKXoyF4o.js +0 -19
- package/dist/openApi-HKXoyF4o.js.map +0 -1
- package/dist/src-Ba-zyEiS.js +0 -11
- package/dist/src-CNO_U6s-.cjs +0 -19
|
@@ -93,7 +93,40 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
93
93
|
// fetch must be assigned here, otherwise it would throw the error:
|
|
94
94
|
// TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation
|
|
95
95
|
const _fetch = opts.fetch!;
|
|
96
|
-
let response
|
|
96
|
+
let response: Response;
|
|
97
|
+
|
|
98
|
+
try {
|
|
99
|
+
response = await _fetch(request);
|
|
100
|
+
} catch (error) {
|
|
101
|
+
// Handle fetch exceptions (AbortError, network errors, etc.)
|
|
102
|
+
let finalError = error;
|
|
103
|
+
|
|
104
|
+
for (const fn of interceptors.error.fns) {
|
|
105
|
+
if (fn) {
|
|
106
|
+
finalError = (await fn(
|
|
107
|
+
error,
|
|
108
|
+
undefined as any,
|
|
109
|
+
request,
|
|
110
|
+
opts,
|
|
111
|
+
)) as unknown;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
finalError = finalError || ({} as unknown);
|
|
116
|
+
|
|
117
|
+
if (opts.throwOnError) {
|
|
118
|
+
throw finalError;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Return error response
|
|
122
|
+
return opts.responseStyle === 'data'
|
|
123
|
+
? undefined
|
|
124
|
+
: {
|
|
125
|
+
error: finalError,
|
|
126
|
+
request,
|
|
127
|
+
response: undefined as any,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
97
130
|
|
|
98
131
|
for (const fn of interceptors.response.fns) {
|
|
99
132
|
if (fn) {
|