File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 1
1
import * as _ from 'lodash' ;
2
2
import * as os from 'os' ;
3
3
4
- import { delay } from '@httptoolkit/util' ;
4
+ import { ErrorLike , delay } from '@httptoolkit/util' ;
5
5
import { generateSPKIFingerprint } from 'mockttp' ;
6
6
import { getSystemProxy } from 'os-proxy-config' ;
7
7
@@ -197,10 +197,7 @@ export class ApiModel {
197
197
success : false ,
198
198
metadata : activationError . metadata ,
199
199
error : activationError . reportable !== false
200
- ? {
201
- code : activationError . code ,
202
- message : activationError . message
203
- }
200
+ ? serializeError ( activationError )
204
201
: false
205
202
} ;
206
203
}
@@ -223,6 +220,12 @@ export class ApiModel {
223
220
224
221
}
225
222
223
+ const serializeError = ( error : ErrorLike ) : { } => ( {
224
+ message : error . message ,
225
+ code : error . code ,
226
+ cause : error . cause ? serializeError ( error . cause ) : undefined
227
+ } ) ;
228
+
226
229
// Wait for a promise, falling back to defaultValue on error or timeout
227
230
const withFallback = < R > ( p : ( ) => Promise < R > , timeoutMs : number , defaultValue : R ) =>
228
231
Promise . race ( [
You can’t perform that action at this time.
0 commit comments