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

Error thrown directly in sagas crash the app and/or stop subsequent saga execution #1838

Closed
2 of 4 tasks
LaurynasGr opened this issue Nov 5, 2024 · 3 comments
Closed
2 of 4 tasks
Labels

Comments

@LaurynasGr
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

If an error is thrown in a saga directly (not in a command handler further down the road) the app crashes unless there's a global process.on('uncaughtException').

If we do have process.on('uncaughtException') the app stays open, but any subsequent events do not trigger the same saga after the first time it throws an error.

These errors are not handled and are not forwarded to UnhandledExceptionBus.

Minimum reproduction code

https://github.com/LaurynasGr/nestjs-saga-error-demo

Steps to reproduce

Steps to reproduce in example repo README https://github.com/LaurynasGr/nestjs-saga-error-demo/tree/main?tab=readme-ov-file#setup

Expected behavior

Errors should be handled the same way as it is handled when thrown in command handlers (logged to console and pushed to UnhandledExceptionBus)

Package version

10.2.8

NestJS version

10.0.0

Node.js version

22.9.0

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

@LaurynasGr LaurynasGr added the bug label Nov 5, 2024
@kamilmysliwiec
Copy link
Member

Would you like to create a PR for this issue? You can follow this PR #1399 for reference

@LaurynasGr
Copy link
Author

Might have some time this week, will try to look into this.

@kamilmysliwiec
Copy link
Member

#1861

@nestjs nestjs locked and limited conversation to collaborators Dec 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants