UNPKG

@m10s/cmp

Version:

Package containing scripts used by Schibsteds' sites to integrate with Sourcepoint CMP

25 lines (21 loc) 946 B
export function appendSentryEvents(config) { config.events = config.events || {}; config.events.onError = function (message_type, errorCode, errorObject) { try { if (message_type) window._cmp_.sentry.setTag('message_type', message_type); if (errorCode) window._cmp_.sentry.setTag('errorCode', errorCode); window._cmp_.sentry.setTag('propertyId', config.propertyId); window._cmp_.sentry.captureException(errorObject); } catch (err) { console.error(`Can not send the error to Sentry, ${err}`); } }; config.events.onMessageChoiceError = function (message_type, err) { try { if (message_type) window._cmp_.sentry.setTag('message_type', message_type); window._cmp_.sentry.captureException(err); } catch (err) { console.error(`Can not send the error to Sentry, ${err}`); } }; };