-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #778 from adobecom/dc-hosted-error-detail
pass wrappedException object and log individual fields: type, name and message
- Loading branch information
Showing
4 changed files
with
42 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
test/blocks/dc-converter-widget/dc-converter-widget-error.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* eslint-disable compat/compat */ | ||
/* eslint-disable no-underscore-dangle */ | ||
/* eslint-disable object-curly-newline */ | ||
import { readFile } from '@web/test-runner-commands'; | ||
import { expect } from '@esm-bundle/chai'; | ||
import sinon from 'sinon'; | ||
import { delay } from '../../helpers/waitfor.js'; | ||
|
||
const { default: init } = await import( | ||
'../../../acrobat/blocks/dc-converter-widget/dc-converter-widget.js' | ||
); | ||
|
||
describe('dc-converter-widget block', () => { | ||
before(async () => { | ||
document.head.innerHTML = await readFile({ path: './mocks/head.html' }); | ||
document.body.innerHTML = await readFile({ path: './mocks/body_cache.html' }); | ||
const block = document.body.querySelector('.dc-converter-widget'); | ||
await init(block); | ||
}); | ||
|
||
afterEach(() => { | ||
sinon.restore(); | ||
}); | ||
|
||
it('handles an error in DC_Hosted:Ready', async () => { | ||
window.lana = { log: sinon.stub() }; | ||
window.dc_hosted = { | ||
getUserLimits: async () => null, | ||
}; | ||
window.dispatchEvent(new CustomEvent('DC_Hosted:Ready')); | ||
await delay(100); | ||
expect(window.lana.log.getCall(0).args[0]).to.eq('DC Widget failed. type=undefined name=TypeError message=Cannot read properties of null (reading \'upload\')'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters