Skip to content

Instantly share code, notes, and snippets.

@ronaldozanoni
Forked from danharper/normalize-filenames.js
Last active April 10, 2018 23:54
Show Gist options
  • Save ronaldozanoni/ff1c3d714c2c18219a9587b4d7cc7af8 to your computer and use it in GitHub Desktop.
Save ronaldozanoni/ff1c3d714c2c18219a9587b4d7cc7af8 to your computer and use it in GitHub Desktop.
use Sentry (Raven) on PhoneGap
Raven.config(dsn, {
dataCallback: function(data) {
var normalize = function(filename) {
// sometimes the filename is [native code]
if (filename.indexOf('/www/') !== -1) {
return '~/' + filename.split('/www/', 2)[1];
}
return filename;
};
var frames = data.exception.values[0].stacktrace.frames;
for (var index = 0, len = frames.length; index < len; index++) {
var frame = frames[index];
frame.filename = normalize(frame.filename);
}
data.culprit = frames[0].filename;
return data;
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment