From 50128c4ae714fc3f77d3af64dd4dea938cfeda17 Mon Sep 17 00:00:00 2001 From: Adam Peller <46139+peller@users.noreply.github.com> Date: Thu, 15 Aug 2024 23:31:25 -0400 Subject: [PATCH 1/4] pass detail from IMS failure --- acrobat/scripts/scripts.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/acrobat/scripts/scripts.js b/acrobat/scripts/scripts.js index ef7ef3f0..84d67d4c 100644 --- a/acrobat/scripts/scripts.js +++ b/acrobat/scripts/scripts.js @@ -465,8 +465,9 @@ const { ietf } = getLocale(locales); loadIms().then(() => { const imsIsReady = new CustomEvent('IMS:Ready'); window.dispatchEvent(imsIsReady); - }).catch(() => { - window.dispatchEvent(new CustomEvent('DC_Hosted:Error')); + }).catch(err => { + const detail = JSON.stringify(err, Object.getOwnPropertyNames(err)); + window.dispatchEvent(new CustomEvent('DC_Hosted:Error', { detail })); }); loadLana({ clientId: 'dxdc', tags: 'DC_Milo' }); From b376896b3d910bdf9723562b5ca53497141a482d Mon Sep 17 00:00:00 2001 From: Adam Peller <46139+peller@users.noreply.github.com> Date: Thu, 15 Aug 2024 23:33:55 -0400 Subject: [PATCH 2/4] pass error detail --- acrobat/blocks/dc-converter-widget/dc-converter-widget.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/acrobat/blocks/dc-converter-widget/dc-converter-widget.js b/acrobat/blocks/dc-converter-widget/dc-converter-widget.js index 6d5d5a81..1d829c76 100644 --- a/acrobat/blocks/dc-converter-widget/dc-converter-widget.js +++ b/acrobat/blocks/dc-converter-widget/dc-converter-widget.js @@ -331,8 +331,9 @@ export default async function init(element) { const personalizationIsReady = new CustomEvent('Personalization:Ready'); window.dispatchEvent(personalizationIsReady); - }).catch(() => { - window.dispatchEvent(new CustomEvent('DC_Hosted:Error')); + }).catch(err => { + const detail = JSON.stringify(err, Object.getOwnPropertyNames(err)); + window.dispatchEvent(new CustomEvent('DC_Hosted:Error', { detail })); }); }); From d4e8dfa11f128ec01c2f1a7a375eb9df9fac3f3d Mon Sep 17 00:00:00 2001 From: Adam Peller <46139+peller@users.noreply.github.com> Date: Fri, 16 Aug 2024 00:10:37 -0400 Subject: [PATCH 3/4] Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- acrobat/blocks/dc-converter-widget/dc-converter-widget.js | 2 +- acrobat/scripts/scripts.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/acrobat/blocks/dc-converter-widget/dc-converter-widget.js b/acrobat/blocks/dc-converter-widget/dc-converter-widget.js index 1d829c76..14eb0b4d 100644 --- a/acrobat/blocks/dc-converter-widget/dc-converter-widget.js +++ b/acrobat/blocks/dc-converter-widget/dc-converter-widget.js @@ -331,7 +331,7 @@ export default async function init(element) { const personalizationIsReady = new CustomEvent('Personalization:Ready'); window.dispatchEvent(personalizationIsReady); - }).catch(err => { + }).catch((err) => { const detail = JSON.stringify(err, Object.getOwnPropertyNames(err)); window.dispatchEvent(new CustomEvent('DC_Hosted:Error', { detail })); }); diff --git a/acrobat/scripts/scripts.js b/acrobat/scripts/scripts.js index 84d67d4c..3754edd6 100644 --- a/acrobat/scripts/scripts.js +++ b/acrobat/scripts/scripts.js @@ -465,7 +465,7 @@ const { ietf } = getLocale(locales); loadIms().then(() => { const imsIsReady = new CustomEvent('IMS:Ready'); window.dispatchEvent(imsIsReady); - }).catch(err => { + }).catch((err) => { const detail = JSON.stringify(err, Object.getOwnPropertyNames(err)); window.dispatchEvent(new CustomEvent('DC_Hosted:Error', { detail })); }); From e4dde7cf76e956fe04d60dca779c2de3c2671a55 Mon Sep 17 00:00:00 2001 From: Adam Peller <46139+peller@users.noreply.github.com> Date: Mon, 19 Aug 2024 13:50:41 -0400 Subject: [PATCH 4/4] add error detail to log --- acrobat/blocks/dc-converter-widget/dc-converter-widget.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/acrobat/blocks/dc-converter-widget/dc-converter-widget.js b/acrobat/blocks/dc-converter-widget/dc-converter-widget.js index 60d587f9..c05f5e6b 100644 --- a/acrobat/blocks/dc-converter-widget/dc-converter-widget.js +++ b/acrobat/blocks/dc-converter-widget/dc-converter-widget.js @@ -337,7 +337,7 @@ export default async function init(element) { }); }); - window.addEventListener('DC_Hosted:Error', () => { + window.addEventListener('DC_Hosted:Error', (err) => { const dropZone = document.querySelector('.dropZoneContent'); if (dropZone && !dropZone.classList.contains('unavailable')) { dropZone.classList.add('unavailable'); @@ -347,6 +347,6 @@ export default async function init(element) { dropZone.innerHTML = '
We apologize for the inconvenience. We are working hard to make the service available. Please check back shortly.
'; document.querySelector('div[class*="DropZoneFooter__dropzoneFooter"]').innerHTML = ''; } - window.lana?.log('DC Widget failed', lanaOptions); + window.lana?.log('DC Widget failed. detail: ${JSON.stringify(err.detail)}', lanaOptions); }); }