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

When Second Level Retries are enabled the previous exceptions are swallowed if the handler is not implemented #1195

Open
arielmoraes opened this issue Feb 20, 2025 · 1 comment

Comments

@arielmoraes
Copy link

arielmoraes commented Feb 20, 2025

Our Rebus usage have some default configurations for the developers to follow. One of those configurations is the Second Level Retry as enabled. In newer version of Rebus it's dispatched as soon as the error count reaches the configured limit. As not all messages handlers implementations want to enable second level retries, the IFailed is not implemented on some of them. The problem is the code is swallowing the previous exceptions in case of errors so the error details header will end up with only the MessageCouldNotBeDispatchedToAnyHandlersException error. This is a regression from previous versions.

The problematic line is:

await PassToErrorHandler(context, GetAggregateException(new[] { _exceptionInfoFactory.CreateInfo(secondLevelException) }));

Can that be changed to be like:

await PassToErrorHandler(context, GetAggregateException(exceptions.Concat(new[] { _exceptionInfoFactory.CreateInfo(secondLevelException), })));

If that is the intended way from now on, is there a way to have Second Level Retries enabled but as a opt-in per message handler?

@arielmoraes
Copy link
Author

Adding some information, it seems that every time a fail fast exception should be handled, only the failed fast exception is recorded.

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