Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event Listeners Stop Processing on Exception #141

Open
bryanpieperfl opened this issue Jul 15, 2022 · 0 comments
Open

Event Listeners Stop Processing on Exception #141

bryanpieperfl opened this issue Jul 15, 2022 · 0 comments

Comments

@bryanpieperfl
Copy link

I was testing if you have multiple event listeners attached to an event looking to determine what happens if one of them throws an error. Wanted to understand if the subsequent event listener handlers would continue.

Expected Behaviour

When you have multiple handlers attached to an event, if one throws an error, the remaining handlers do get called.

Actual Behaviour

When you have multiple handlers attached to an event, if one throws an error, the remaining do not get called.

Steps to Reproduce

  1. Add a few event listeners
  2. Throw an Error on the 2nd handler
  3. The remaining handlers will not get called

adobeDataLayer.addEventListener('pageView', function(evt) { console.log('EDDL pageView 1st handler'); }); adobeDataLayer.addEventListener('pageView', function(evt) { console.log('EDDL pageView 2nd handler'); throw new Error("EDDL pageView error"); }); adobeDataLayer.addEventListener('pageView', function(evt) { console.log('EDDL pageView 3rd handler'); }); adobeDataLayer.addEventListener('pageView', function(evt) { console.log('EDDL pageView 4th handler'); }); adobeDataLayer.push({ event: 'pageView'});

Platform and Version

Adobe Client Data Layer 2.0.2
Adobe Client Data Layer Extension in Adobe Launch v2.0.3

Logs taken while reproducing problem

VM1407:85 EDDL pageView 1st handler
VM1407:85 EDDL pageView 2nd handler
launch-EN2e353a6bcf6449339e47775da0327ac7.min.js:11 Uncaught Error: EDDL pageView error
at Array. (:8:9)
at t (launch-EN2e353a6bcf6449339e47775da0327ac7.min.js:12:1753)
at launch-EN2e353a6bcf6449339e47775da0327ac7.min.js:12:2529
at Array.forEach ()
at Object.triggerListeners (launch-EN2e353a6bcf6449339e47775da0327ac7.min.js:12:2415)
at Object.event (launch-EN2e353a6bcf6449339e47775da0327ac7.min.js:11:31064)
at n (launch-EN2e353a6bcf6449339e47775da0327ac7.min.js:11:31546)
at launch-EN2e353a6bcf6449339e47775da0327ac7.min.js:11:32132
at Array.forEach ()
at Array.g.push (launch-EN2e353a6bcf6449339e47775da0327ac7.min.js:11:32011)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant