Skip to content

Commit

Permalink
remove unused code to overwrite filenames for Sentry error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
sethkfman committed Aug 1, 2023
1 parent c2de64e commit d0cfe1a
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions app/util/sentryUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function rewriteBreadcrumb(breadcrumb) {
if (breadcrumb.data?.from) {
breadcrumb.data.from = getProtocolFromURL(breadcrumb.data.from);
}
console.log('Breadcrumb', breadcrumb);

return breadcrumb;
}
Expand Down Expand Up @@ -73,17 +74,8 @@ function simplifyErrorMessages(report) {

function rewriteReportUrls(report) {
// update request url
report.request.url = toMetamaskUrl();
// update exception stack trace
if (report.exception && report.exception.values) {
report.exception.values.forEach((item) => {
if (item.stacktrace) {
item.stacktrace.frames.forEach((frame) => {
frame.filename = toMetamaskUrl(frame.filename);
});
}
});
}
console.log('rewriteReportUrls', report);
report.request.url = toMetamaskUrl(report.request.url);
}

function removeDeviceTimezone(report) {
Expand All @@ -96,12 +88,19 @@ function removeDeviceName(report) {
report.contexts.device.name = null;
}

function toMetamaskUrl() {
const metamaskUrl = `metamask-mobile`;
return metamaskUrl;
function toMetamaskUrl(origUrl) {
const filePath = origUrl?.split(location.origin)[1];
if (!filePath) {
return origUrl;
}

const metamaskUrl = 'metamask-mobile';
return metamaskUrl;
}


function rewriteReport(report) {
console.log('start', report.exception.values[0].stacktrace.frames);
try {
// simplify certain complex error messages (e.g. Ethjs)
simplifyErrorMessages(report);
Expand All @@ -123,6 +122,8 @@ function rewriteReport(report) {
throw err;
}

console.log('Report', report.exception.values[0].stacktrace.frames);

return report;
}

Expand Down

0 comments on commit d0cfe1a

Please sign in to comment.