@@ -75,28 +75,28 @@ export class ContextLines implements Integration {
75
75
public async addSourceContext ( event : Event , contextLines : number ) : Promise < Event > {
76
76
if ( contextLines > 0 && event . exception ?. values ) {
77
77
for ( const exception of event . exception . values ) {
78
- await this . _addSourceContextToFrames ( exception . stacktrace ?. frames , contextLines ) ;
78
+ if ( exception . stacktrace ?. frames ) {
79
+ await this . _addSourceContextToFrames ( exception . stacktrace . frames , contextLines ) ;
80
+ }
79
81
}
80
82
}
81
83
82
84
return event ;
83
85
}
84
86
85
87
/** Adds context lines to frames */
86
- public async _addSourceContextToFrames ( frames : StackFrame [ ] | undefined , contextLines : number ) : Promise < void > {
87
- if ( frames ) {
88
- for ( const frame of frames ) {
89
- if ( frame . filename ) {
90
- const sourceFile = await _readSourceFile ( frame . filename ) ;
91
-
92
- if ( sourceFile ) {
93
- try {
94
- const lines = sourceFile . split ( '\n' ) ;
95
- addContextToFrame ( lines , frame , contextLines ) ;
96
- } catch ( e ) {
97
- // anomaly, being defensive in case
98
- // unlikely to ever happen in practice but can definitely happen in theory
99
- }
88
+ public async _addSourceContextToFrames ( frames : StackFrame [ ] , contextLines : number ) : Promise < void > {
89
+ for ( const frame of frames ) {
90
+ if ( frame . filename ) {
91
+ const sourceFile = await _readSourceFile ( frame . filename ) ;
92
+
93
+ if ( sourceFile ) {
94
+ try {
95
+ const lines = sourceFile . split ( '\n' ) ;
96
+ addContextToFrame ( lines , frame , contextLines ) ;
97
+ } catch ( e ) {
98
+ // anomaly, being defensive in case
99
+ // unlikely to ever happen in practice but can definitely happen in theory
100
100
}
101
101
}
102
102
}
0 commit comments