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 11import * as _ from 'lodash' ;
22import * as os from 'os' ;
33
4- import { delay } from '@httptoolkit/util' ;
4+ import { ErrorLike , delay } from '@httptoolkit/util' ;
55import { generateSPKIFingerprint } from 'mockttp' ;
66import { getSystemProxy } from 'os-proxy-config' ;
77
@@ -197,10 +197,7 @@ export class ApiModel {
197197 success : false ,
198198 metadata : activationError . metadata ,
199199 error : activationError . reportable !== false
200- ? {
201- code : activationError . code ,
202- message : activationError . message
203- }
200+ ? serializeError ( activationError )
204201 : false
205202 } ;
206203 }
@@ -223,6 +220,12 @@ export class ApiModel {
223220
224221}
225222
223+ const serializeError = ( error : ErrorLike ) : { } => ( {
224+ message : error . message ,
225+ code : error . code ,
226+ cause : error . cause ? serializeError ( error . cause ) : undefined
227+ } ) ;
228+
226229// Wait for a promise, falling back to defaultValue on error or timeout
227230const withFallback = < R > ( p : ( ) => Promise < R > , timeoutMs : number , defaultValue : R ) =>
228231 Promise . race ( [
You can’t perform that action at this time.
0 commit comments