Closed nobugsincode closed 1 year ago
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.
Not stale yet :)
I think the right thing to do here is to remove these extra interfaces. They can confuse the registration and resolution logic.
I have a custom exception defined in my project
public class CustomException : Exception
. To log the exception I'm trying to use 2 approaches: one usingIRequestExceptionAction<TRequest>
and the second usingIRequestExceptionAction<TRequest, TException>
. MediatR registered in the service collection viaservices.AddMediatr(config => ...)
Problem
When I throw
CustomException
in one of my RequestHandlers I'm getting an invalid log lines in my console.Expected behavior
I see a single log line for the exception thrown
Actual behavior
I see two log lines for same exception. Implementation of
IRequestExceptionHandler<TRequest>
not called at all.Questions
Is it a bug or it's a desired behavior? I'm asking because multiple actions found here which looks quite intentional. But in this case what's the point of performing the same action multiple times? At the same time I don't see any registration for
IRequestExceptionAction<TRequest>
but only forIRequestExceptionAction<TRequest, TException>
here. So what's the point to have any implementation ofIRequestExceptionAction<TRequest>
?