@@ -181,7 +181,7 @@ function shouldReadFrameFile(frameFilename, callback) {
181
181
isCached = ! ! cache . get ( frameFilename ) ;
182
182
isPending = ! ! pendingReads [ frameFilename ] ;
183
183
184
- callback ( isValidFilename && ! isCached && ! isPending ) ;
184
+ callback ( null , isValidFilename && ! isCached && ! isPending ) ;
185
185
}
186
186
187
187
@@ -201,19 +201,13 @@ function readFileLines(filename, callback) {
201
201
}
202
202
}
203
203
204
-
205
- /* Older versions of node do not have fs.exists so we implement our own */
206
204
function checkFileExists ( filename , callback ) {
207
205
if ( stackTrace . sourceContent ( filename ) ) {
208
- return callback ( true ) ;
209
- }
210
- if ( fs . exists !== undefined ) {
211
- fs . exists ( filename , callback ) ;
212
- } else {
213
- fs . stat ( filename , function ( err ) {
214
- callback ( ! err ) ;
215
- } ) ;
206
+ return callback ( null , true ) ;
216
207
}
208
+ fs . stat ( filename , function ( err ) {
209
+ callback ( null , ! err ) ;
210
+ } ) ;
217
211
}
218
212
219
213
@@ -226,7 +220,9 @@ function gatherContexts(frames, callback) {
226
220
}
227
221
} ) ;
228
222
229
- async . filter ( frameFilenames , shouldReadFrameFile , function ( results ) {
223
+ async . filter ( frameFilenames , shouldReadFrameFile , function ( err , results ) {
224
+ if ( err ) return callback ( err ) ;
225
+
230
226
var tempFileCache ;
231
227
232
228
tempFileCache = { } ;
@@ -270,7 +266,8 @@ function gatherContexts(frames, callback) {
270
266
callback ( null ) ;
271
267
}
272
268
273
- async . filter ( results , checkFileExists , function ( filenames ) {
269
+ async . filter ( results , checkFileExists , function ( err , filenames ) {
270
+ if ( err ) return callback ( err ) ;
274
271
async . each ( filenames , gatherFileData , function ( err ) {
275
272
if ( err ) {
276
273
return callback ( err ) ;
@@ -367,7 +364,8 @@ exports.parseStack = function (stack, options, item, callback) {
367
364
return callback ( err ) ;
368
365
}
369
366
frames . reverse ( ) ;
370
- async . filter ( frames , function ( frame , callback ) { callback ( ! ! frame ) ; } , function ( results ) {
367
+ async . filter ( frames , function ( frame , callback ) { callback ( null , ! ! frame ) ; } , function ( err , results ) {
368
+ if ( err ) return callback ( err ) ;
371
369
gatherContexts ( results , callback ) ;
372
370
} ) ;
373
371
} ) ;
0 commit comments