Improved capture of messages to sentry

refs: https://github.com/TryGhost/Team/issues/1121

- use captureMessage instead of captureException in showAlert as showAlert should always have a String not an Error
   - this should hopefully improve how these things appear in Sentry
- moved source to a tag, not context, so we can filter on the source in sentry UI
This commit is contained in:
Hannah Wolfe 2022-09-08 11:21:06 +01:00
parent 0ad501ec4b
commit 2cc5c15ca4

View File

@ -103,15 +103,15 @@ export default class NotificationsService extends Service {
ghost: {
displayed_message: displayedMessage,
ghost_error_code: options.ghostErrorCode,
full_error: message,
source: 'showAlert'
full_error: message
}
};
Sentry.captureException(displayedMessage, {
Sentry.captureMessage(displayedMessage, {
contexts,
tags: {
shown_to_user: true
shown_to_user: true,
source: 'showAlert'
}
});
}
@ -196,12 +196,12 @@ export default class NotificationsService extends Service {
ghost: {
ghost_error_code: resp.ghostErrorCode,
displayed_message: msg,
full_error: resp,
source: 'showAPIError'
full_error: resp
}
},
tags: {
shown_to_user: true
shown_to_user: true,
source: 'showAPIError'
}
});
}