Skip to content

Conversation

@raymondfeng
Copy link
Contributor

@raymondfeng raymondfeng commented Apr 2, 2020

The unhandled error is reported when context-observer.unit.ts is run by itself. The root cause is that ContextSubscriptionManager always emits errors to the context chain without checking if there is an error listener on itself.

Checklist

👉 Read and sign the CLA (Contributor License Agreement) 👈

  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • API Documentation in code was updated
  • Documentation in /docs/site was updated
  • Affected artifact templates in packages/cli were updated
  • Affected example projects in examples/* were updated

👉 Check out how to submit a PR 👈

@raymondfeng
Copy link
Contributor Author

FYI: The PR fixed an unhandled error in the test. As a result, the test coverage goes down a bit, which is expected as the test does not crash or warn unhandled promise rejections.

@dhmlau dhmlau added this to the April 2020 milestone Apr 2, 2020
@raymondfeng raymondfeng added the IoC/Context @loopback/context: Dependency Injection, Inversion of Control label Apr 2, 2020
@raymondfeng raymondfeng force-pushed the fix-context-observer-test branch from 66aa96b to 2833069 Compare April 3, 2020 18:18
@raymondfeng raymondfeng changed the title fix(context): fix context observer unit test to handle errors fix(context): fix context observer to catch errors by waitUntilPendingNotificationsDone Apr 3, 2020
@raymondfeng raymondfeng requested a review from bajtos April 3, 2020 18:23
@raymondfeng raymondfeng force-pushed the fix-context-observer-test branch from 2833069 to b260731 Compare April 3, 2020 22:32
@raymondfeng raymondfeng changed the title fix(context): fix context observer to catch errors by waitUntilPendingNotificationsDone fix(context): fix context subscription manager to not emit errors to its context if there is an error listener is in place Apr 3, 2020
@raymondfeng raymondfeng merged commit 3dad6c0 into master Apr 6, 2020
@raymondfeng raymondfeng deleted the fix-context-observer-test branch April 6, 2020 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

IoC/Context @loopback/context: Dependency Injection, Inversion of Control

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants