Implement the ability to exclude certain file names (extensions for now)

This commit is contained in:
Zalmoxisus 2018-12-14 22:01:39 +02:00
parent 983aeb71ab
commit 2960ac6eae
4 changed files with 11 additions and 6 deletions

View File

@ -0,0 +1 @@
export const toExclude = /chrome-extension:\/\/|moz-extension:\/\//;

View File

@ -10,6 +10,7 @@ import type { StackFrame } from './stack-frame';
import { parse } from './parser';
import { map } from './mapper';
import { unmap } from './unmapper';
import { toExclude } from '../../presets';
function getStackFrames(
error: Error,
@ -39,9 +40,10 @@ function getStackFrames(
}
*/
return enhancedFrames.filter(
({ functionName }) =>
functionName == null ||
functionName.indexOf('__stack_frame_overlay_proxy_console__') === -1
({ functionName, fileName }) =>
(functionName == null ||
functionName.indexOf('__stack_frame_overlay_proxy_console__') === -1) &&
!toExclude.test(fileName)
);
});
}

View File

@ -19,7 +19,7 @@ const actions = {
1: { type: 'PERFORM_ACTION', action: { type: 'INCREMENT_COUNTER' } },
2: {
type: 'PERFORM_ACTION', action: { type: 'INCREMENT_COUNTER' },
stack: 'Error\n at fn1 (app.js:72:24)\n at fn2 (app.js:84:31)'
stack: 'Error\n at fn1 (app.js:72:24)\n at fn2 (app.js:84:31)\n at fn3 (chrome-extension://lmhkpmbekcpmknklioeibfkpmmfibljd/js/page.bundle.js:1269:80)'
}
};

View File

@ -57,7 +57,8 @@ exports[`StackTraceTab component should render with props, but without stack 1`]
},
"stack": "Error
at fn1 (app.js:72:24)
at fn2 (app.js:84:31)",
at fn2 (app.js:84:31)
at fn3 (chrome-extension://lmhkpmbekcpmknklioeibfkpmmfibljd/js/page.bundle.js:1269:80)",
"type": "PERFORM_ACTION",
},
}
@ -118,7 +119,8 @@ exports[`StackTraceTab component should render with trace stack 1`] = `
},
"stack": "Error
at fn1 (app.js:72:24)
at fn2 (app.js:84:31)",
at fn2 (app.js:84:31)
at fn3 (chrome-extension://lmhkpmbekcpmknklioeibfkpmmfibljd/js/page.bundle.js:1269:80)",
"type": "PERFORM_ACTION",
},
}