mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
Masked post and page IDs in Ember Data errors (#19035)
no issue - The standard error message from Ember Data includes post/page ids in the error message - This causes Sentry to treat each instance as a unique issue and results in many duplicate issues for the same error - This change should mask the ids and allow Sentry to group the errors correctly
This commit is contained in:
parent
d6c5ce3d02
commit
c0e39affd0
1 changed files with 7 additions and 0 deletions
|
@ -191,6 +191,13 @@ export default Route.extend(ShortcutsRoute, {
|
|||
return null;
|
||||
}
|
||||
|
||||
// if the error value includes a model id then overwrite it to improve grouping
|
||||
if (event.exception.values && event.exception.values.length > 0) {
|
||||
const pattern = /<(post|page):[a-f0-9]+>/;
|
||||
const replacement = '<$1:ID>';
|
||||
event.exception.values[0].value = event.exception.values[0].value.replace(pattern, replacement);
|
||||
}
|
||||
|
||||
// ajax errors — improve logging and add context for debugging
|
||||
if (isAjaxError(exception)) {
|
||||
const error = exception.payload.errors[0];
|
||||
|
|
Loading…
Add table
Reference in a new issue