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

A thrown error in a handler can prevent other handlers from being called #64

Closed
kanongil opened this issue Oct 21, 2020 · 0 comments
Closed
Labels
bug Bug or defect
Milestone

Comments

@kanongil
Copy link
Contributor

kanongil commented Oct 21, 2020

Support plan

  • is this issue currently blocking your project? (yes/no): no
  • is this issue affecting a production system? (yes/no): no

Context

  • node version: v14.14.0
  • module version with issue: v4.1.1
  • last module version without issue: none
  • environment (e.g. node, browser, native): node
  • used with (e.g. hapi application, another framework, standalone, ...): standalone
  • any other relevant information:

What are you trying to achieve or the steps to reproduce?

Make all handlers be called, even if other handlers throw.

const Podium = require('@hapi/podium');

const source = new Podium('a');
const emitter = new Podium();
emitter.registerPodium(source);

emitter.on('a', () => console.log('emitted'));

source.emit('a');

source.on('a', () => {

    throw new Error('fail');
});

source.emit('a').catch(() => undefined);

What was the result you got?

emitted

What result did you expect?

emitted
emitted
@kanongil kanongil added the bug Bug or defect label Oct 21, 2020
kanongil added a commit to kanongil/podium that referenced this issue Oct 16, 2021
@devinivy devinivy added this to the 5.0.0 milestone Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug or defect
Projects
None yet
Development

No branches or pull requests

2 participants