Skip to content

Commit

Permalink
UHF-10908: Moved the UnapprovedItemError class outside of the eventli…
Browse files Browse the repository at this point in the history
…stener.
  • Loading branch information
khalima committed Dec 10, 2024
1 parent f7eab9c commit 8b3db16
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions modules/hdbt_cookie_banner/assets/js/hdbt-cookie-banner.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
'use strict';

class UnapprovedItemError extends Error {
constructor(message, name) {
super(message)
this.name = name
}
}

((Drupal, drupalSettings) => {

// Global cookie consent status object.
Expand Down Expand Up @@ -80,16 +87,9 @@
const name = `Unapproved ${storageType}`
const message = `Found: ${sortedKeys.join(', ')}`

class UnapprovedItemError extends Error {
constructor(message) {
super(message)
this.name = name
}
}

// Capture the error with Sentry and send a message with the
// unapproved items so that they can be searched in Sentry.
window.Sentry.captureException(new UnapprovedItemError(message), {
window.Sentry.captureException(new UnapprovedItemError(message, name), {
level: 'warning',
tags: {
approvedCategories: acceptedGroups.join(', '),
Expand Down

0 comments on commit 8b3db16

Please sign in to comment.