Excluded errors caused by browser power-saving settings

fix https://linear.app/tryghost/issue/SLO-164/error-aborterror-the-play-request-was-interrupted-because-video-only

- in the case that the browser has power-saving settings enabled, we get
  an error in Sentry
- this error does not affect the user experience, so it should be safe
  to ignore
- this adds an exclusion to Sentry to ignore these errors
This commit is contained in:
Daniel Lockyer 2024-06-26 11:39:29 +02:00 committed by Daniel Lockyer
parent 6c07b1cff9
commit 5f5293cf6d

View File

@ -14,6 +14,11 @@ export function beforeSend(event, hint) {
return null;
}
// Ignore errors that are due to browser power saving settings
if (exception?.message?.includes('The play() request was interrupted because video-only background media was paused to save power.')) {
return null;
}
// if the error value includes a model id then overwrite it to improve grouping
if (event.exception && event.exception.values && event.exception.values.length > 0) {
const pattern = /<(post|page):[a-f0-9]+>/;