Closed JonnyBooker closed 7 years ago
While it's not immediately obvious, it IS actually possible to tell that an exception occurred while handling a message from within the AfterMessageHandled
listener.
As you can see here the exception gets stashed in the IncomingStepContext
when caught, allowing you to retrieve it from your listener by calling
var exceptionOrNull = context.Load<Exception>();
if (exceptionOrNull == null) return; //< nothing to do
// inspect exception here - possibly doing this if you want
// to ignore it:
args.IgnoreException = true;
Just what I need. Thank you very much!
for events.AfterMessageHandled += (bus, headers, message, context, args) , I am getting null for IBus. I am using Autofac as DI. Any idea why?
Thanks @abhay-naik for reporting this 😄 it was a genuine bug, which I have now fixed. The fix is available in Rebus.Events 4.0.1, which is on NuGet.org in a few minutes.
You are so awesome....thanks so much.
On Sun, Sep 30, 2018, 8:13 PM Mogens Heller Grabe notifications@github.com wrote:
Thanks @abhay-naik https://github.com/abhay-naik for reporting this 😄 it was a genuine bug, which I have now fixed. The fix is available in Rebus.Events 4.0.1, which is on NuGet.org in a few minutes.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rebus-org/Rebus.Events/issues/1#issuecomment-425725740, or mute the thread https://github.com/notifications/unsubscribe-auth/ABEwngBY_fUFVbR0wDSvqiu8ZiLKL2JPks5ugNiqgaJpZM4MECE8 .
I am using the IHandlesMessages pattern to handle messages. I have forced an exception within the
Handle
logic and theAfterMessageHandled
is now being hit. I was wondering if is possible to tell if now the message has handled that you can tell if the handling of a message threw an exception?