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:
parent
0331799242
commit
547f50312e
3 changed files with 24 additions and 1 deletions
18
src/raven.js
18
src/raven.js
|
@ -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 = {},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue