@hey-api/openapi-ts 0.78.2 → 0.78.3

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.
@@ -143,14 +143,16 @@ export const createClient = (config: Config = {}): Client => {
143
143
  };
144
144
  }
145
145
 
146
- let error = await response.text();
146
+ const textError = await response.text();
147
+ let jsonError: unknown;
147
148
 
148
149
  try {
149
- error = JSON.parse(error);
150
+ jsonError = JSON.parse(textError);
150
151
  } catch {
151
152
  // noop
152
153
  }
153
154
 
155
+ const error = jsonError ?? textError;
154
156
  let finalError = error;
155
157
 
156
158
  for (const fn of interceptors.error._fns) {
@@ -128,14 +128,16 @@ export const createClient = (config: Config = {}): Client => {
128
128
  };
129
129
  }
130
130
 
131
- let error = await response.text();
131
+ const textError = await response.text();
132
+ let jsonError: unknown;
132
133
 
133
134
  try {
134
- error = JSON.parse(error);
135
+ jsonError = JSON.parse(textError);
135
136
  } catch {
136
137
  // noop
137
138
  }
138
139
 
140
+ const error = jsonError ?? textError;
139
141
  let finalError = error;
140
142
 
141
143
  for (const fn of interceptors.error._fns) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hey-api/openapi-ts",
3
- "version": "0.78.2",
3
+ "version": "0.78.3",
4
4
  "description": "🚀 The OpenAPI to TypeScript codegen. Generate clients, SDKs, validators, and more.",
5
5
  "homepage": "https://heyapi.dev/",
6
6
  "repository": {