Skip to content

Commit

Permalink
Merge pull request #3832 from rtibbles/event_attachment
Browse files Browse the repository at this point in the history
Upload error as attachment.
  • Loading branch information
bjester authored Nov 22, 2022
2 parents c6f7f9b + 9f0da69 commit 4acc580
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions contentcuration/contentcuration/frontend/shared/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,23 @@ client.interceptors.response.use(
if (process.env.NODE_ENV !== 'production') {
// In dev build log warnings to console for developer use
console.warn('AJAX Request Error: ' + message); // eslint-disable-line no-console
console.warn('Error data: ' + JSON.stringify(error)); // eslint-disable-line no-console
console.warn('Error data: ', error); // eslint-disable-line no-console
} else {
Sentry.captureException(new Error(message), {
contexts: { error },
Sentry.withScope(function(scope) {
scope.addAttachment({
filename: 'error.json',
data: JSON.stringify(error),
contentType: 'application/json',
});
Sentry.captureException(new Error(message), {
extra: {
Request: {
headers: error.config.headers,
method: error.config.method,
url,
},
},
});
});
}
return Promise.reject(error);
Expand Down

0 comments on commit 4acc580

Please sign in to comment.