Skip to content

Commit 4acc580

Browse files
authored
Merge pull request #3832 from rtibbles/event_attachment
Upload error as attachment.
2 parents c6f7f9b + 9f0da69 commit 4acc580

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

  • contentcuration/contentcuration/frontend/shared

contentcuration/contentcuration/frontend/shared/client.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,23 @@ client.interceptors.response.use(
5454
if (process.env.NODE_ENV !== 'production') {
5555
// In dev build log warnings to console for developer use
5656
console.warn('AJAX Request Error: ' + message); // eslint-disable-line no-console
57-
console.warn('Error data: ' + JSON.stringify(error)); // eslint-disable-line no-console
57+
console.warn('Error data: ', error); // eslint-disable-line no-console
5858
} else {
59-
Sentry.captureException(new Error(message), {
60-
contexts: { error },
59+
Sentry.withScope(function(scope) {
60+
scope.addAttachment({
61+
filename: 'error.json',
62+
data: JSON.stringify(error),
63+
contentType: 'application/json',
64+
});
65+
Sentry.captureException(new Error(message), {
66+
extra: {
67+
Request: {
68+
headers: error.config.headers,
69+
method: error.config.method,
70+
url,
71+
},
72+
},
73+
});
6174
});
6275
}
6376
return Promise.reject(error);

0 commit comments

Comments
 (0)