File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -178,18 +178,24 @@ export class Logger {
178178 }
179179
180180 return {
181- error : {
182- type : error . name ,
183- message : error . message ,
184- context : this . shortenData ( ( error as ErrorWithData ) . data ) ,
185- stack_trace : this . shortenStackTrace ( error . stack || '' ) ,
186- } ,
181+ error : this . extractError ( error ) ,
187182 event : {
188183 reason : error . message ,
189184 } ,
190185 } ;
191186 }
192187
188+ private extractError ( error : Error ) : unknown {
189+ const shortenedData = this . shortenData ( ( error as ErrorWithData ) . data ) ;
190+ return {
191+ type : error . name ,
192+ message : error . message ,
193+ ...( shortenedData && { context : shortenedData } ) ,
194+ stack_trace : this . shortenStackTrace ( error . stack || '' ) ,
195+ ...( error . cause instanceof Error && { cause : this . extractError ( error . cause ) } )
196+ } ;
197+ }
198+
193199 private getAxiosErrorDetails ( error : AxiosError ) {
194200 if ( ! error . isAxiosError ) {
195201 return { } ;
Original file line number Diff line number Diff line change 1515 /* Language and Environment */
1616 "target" : " es2020" , /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
1717 // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
18+ "lib" : [
19+ " ES2022.Error"
20+ ],
1821 // "jsx": "preserve", /* Specify what JSX code is generated. */
1922 "experimentalDecorators" : true , /* Enable experimental support for TC39 stage 2 draft decorators. */
2023 "emitDecoratorMetadata" : true , /* Emit design-type metadata for decorated declarations in source files. */
You can’t perform that action at this time.
0 commit comments