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 use the static URL for the current FFZ build to make sure it uses correct source maps.

This commit is contained in:
SirStendec 2018-04-19 16:40:01 -04:00
parent 161b084626
commit e9214bb46a
2 changed files with 12 additions and 6 deletions

View file

@ -12,7 +12,9 @@ import Module from 'utilities/module';
import Raven from 'raven-js';
const AVALON_REG = /\/(?:script|static)\/((?:babel\/)?avalon)(\.js)(\?|#|$)/;
const AVALON_REG = /\/(?:script|static)\/((?:babel\/)?avalon)(\.js)(\?|#|$)/,
fix_url = url => url.replace(AVALON_REG, `/static/$1.${__webpack_hash__}$2$3`);
const BAD_URLS = [
'hls.ttvnw.net',
@ -186,6 +188,12 @@ export default class RavenLogger extends Module {
data.extra = Object.assign(this.buildExtra(), data.extra);
data.tags = Object.assign(this.buildTags(), data.tags);
if ( data.exception && Array.isArray(data.exception.values) )
data.exception.values = this.rewriteStack(data.exception.values, data);
if ( data.culprit )
data.culprit = fix_url(data.culprit);
if ( data.tags.example ) {
if ( this.__example_waiter ) {
this.__example_waiter(data);
@ -195,14 +203,12 @@ 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();
}
onEnable() {
this.log.info('Installed error tracking.');
}
@ -214,7 +220,7 @@ export default class RavenLogger extends Module {
continue;
for(const frame of err.stacktrace.frames)
frame.filename = frame.filename.replace(AVALON_REG, `/static/$1.${__webpack_hash__}$2$3`)
frame.filename = fix_url(frame.filename);
}
return errors;