Skip to content

Commit

Permalink
Merge pull request #760 from adobecom/dc-hosted-error-detail
Browse files Browse the repository at this point in the history
pass detail from widget failures
  • Loading branch information
Blainegunn authored Aug 19, 2024
2 parents 47faa3b + 2e4bc17 commit a98d36c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
9 changes: 5 additions & 4 deletions acrobat/blocks/dc-converter-widget/dc-converter-widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,12 +331,13 @@ 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 }));
});
});

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');
Expand All @@ -346,6 +347,6 @@ export default async function init(element) {
dropZone.innerHTML = '<img src="/acrobat/img/icons/error.svg"><p>We apologize for the inconvenience. We are working hard to make the service available. Please check back shortly.</p>';
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);
});
}
5 changes: 3 additions & 2 deletions acrobat/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' });
Expand Down

0 comments on commit a98d36c

Please sign in to comment.