1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-07-25 20:18:31 +00:00

Rewrite stack traces for Sentry to include the proper, static path to the current build to ensure that the correct source map is read by Sentry for displaying the exception.

This commit is contained in:
SirStendec 2018-04-16 18:56:42 -04:00
parent 0331799242
commit 547f50312e
3 changed files with 24 additions and 1 deletions

View file

@ -12,6 +12,8 @@ import Module from 'utilities/module';
import Raven from 'raven-js';
const AVALON_REG = /\/(?:script|static)\/((?:babel\/)?avalon)(\.js)(\?|#|$)/;
const BAD_URLS = [
'hls.ttvnw.net',
'trowel.twitch.tv',
@ -193,6 +195,9 @@ export default class RavenLogger extends Module {
return false;
}
if ( data.exception && Array.isArray(data.exception.values) )
data.exception.values = this.rewriteStack(data.exception.values, data);
return true;
}
}).install();
@ -203,6 +208,19 @@ export default class RavenLogger extends Module {
}
rewriteStack(errors) { // eslint-disable-line class-methods-use-this
for(const err of errors) {
if ( ! err || ! err.stacktrace || ! err.stacktrace.frames )
continue;
for(const frame of err.stacktrace.frames)
frame.filename = frame.filename.replace(AVALON_REG, `/static/$1.${__webpack_hash__}$2$3`)
}
return errors;
}
buildExtra() {
const modules = {},
experiments = {},