• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

medplum / medplum / 30318366797
92%
main: 92%

Build:
Build:
LAST BUILD BRANCH: noah/storybook-package
DEFAULT BRANCH: main
Ran 28 Jul 2026 01:17AM UTC
Jobs 1
Files 847
Run time 2min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

28 Jul 2026 12:47AM UTC coverage: 91.982% (+0.003%) from 91.979%
30318366797

push

github

web-flow
[core]: Improve EventTarget listener exception safety  (#9872)

* [core]: Improve EventTarget listener exception safety

When an EventTarget listener throws an error, it should not prevent the
EventTarget from invoking other listeners registered for the same event
type.

In this commit we wrap event listener invocation with a `try/catch`, so
that each listener is more isolated from failures in others. This made
it difficult to observe issues in these listeners (which used to emit
synchronous errors), so we also add the `setEventListenerErrorHandler`
method which sets a callback that is invoked with the error and the
triggering event.

Breaking change
---------------

Previously, errors in event listeners would be synchronously thrown.
This behavior can be restored by re-throwing the exception inside the
error handler:

```ts
medplum.setEventListenerErrorHandler((error) => { throw error; })
```

This is _discouraged_, as it will cause listeners registered after the
throwing listener to not be invoked with the emitting event.

Signed-off-by: Noah Silas <noah@medplum.com>

* PR Feedback: include event type in default error message

Signed-off-by: Noah Silas <noah@medplum.com>

* PR Feedback: Remove error handling callback

Some thoughts informing this choice:
- The existing behavior (a synchronous throw on a listener error) was an
  implementation detail that deviates from common practices.

- We would like to keep these core APIs minimal. Adding new surface area
  for the error handling listener created an explicit contract that we
  would need to support.

- Callers adding a listener have the most context in what the
  appropriate error handling is. The best thing would be for each caller
  to wrap their callback in a `try`/`catch` and not emit errors that get
  caught by this framework code.

- That said, we still want to protect against situations where a
  callback _does_ throw; it should not prevent other listeners from
  receiving the same event, ... (continued)

22637 of 25717 branches covered (88.02%)

Branch coverage included in aggregate %.

4 of 4 new or added lines in 2 files covered. (100.0%)

40182 of 42578 relevant lines covered (94.37%)

12257.12 hits per line

Jobs
ID Job ID Ran Files Coverage
1 30318366797.1 28 Jul 2026 01:17AM UTC 847
91.98
GitHub Action Run
Source Files on build 30318366797
  • Tree
  • List 847
  • Changed 4
  • Source Changed 2
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #30318366797
  • 9c33182f on github
  • Prev Build on main (#30318218261)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc