Allow easy filtering of exception in the Hub Pipeline Module #1882

Closed
mmanela opened this Issue Apr 16, 2013 · 2 comments

Projects

None yet

4 participants

@mmanela
mmanela commented Apr 16, 2013

In the HupPipelineModule there is a method called OnIncomingError that gets called when an error happens during an incoming message. This method allow you to observe the error but not replace it or suppress it. It would be nice if you could do both. You could add something like what MVC attributes do:

For example replacing an exception

protected virtual void OnIncomingError(ExceptionContext error, IHubIncomingInvokerContext context)
{
    if(error.Exception.GetType() == typeof(SuperSecretException)){
        error.Exception = new GenericException("uh oh's!");
    }
}

Or marking an exception handled:

protected virtual void OnIncomingError(ExceptionContext error, IHubIncomingInvokerContext context)
{
    error.ExceptionHandled= true;
}
@davidfowl
Member

This is possible today if you return a different faulted task but we can make it easier.

@halter73 halter73 was assigned Aug 2, 2013
@halter73 halter73 added a commit that referenced this issue Aug 7, 2013
@halter73 halter73 Cleanup based on code review
- Simplified ExeptionContext
- Removed constructor with innerException from HubException
- Preserve stack trace for unchanged exception from OnIncomingError
- Made new functional tests async

#1882
c0beb03
@halter73 halter73 added a commit that referenced this issue Aug 7, 2013
@halter73 halter73 Cleanup based on code review
- Simplified ExeptionContext
- Removed constructor with innerException from HubException
- Preserve stack trace for unchanged exception from OnIncomingError
- Made new functional tests async

#1882
a18ea46
@gustavo-armenta
Contributor

tested

  • Replacing exception
  • Setting a null result
  • Setting a non-null result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment