File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
packages/openapi-ts/src/plugins/@hey-api Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -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 ) {
Original file line number Diff line number Diff line change @@ -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 ) {
You can’t perform that action at this time.
0 commit comments