HttpErrorHandler, proper use, registration?

Topics: Web Api
Sep 7, 2011 at 3:42 AM

Hi there,

I created:

public class BadRequestErrorHandler : HttpErrorHandler {...}

I registered it as follows:

//TODO: sb: go back to routes.MapServiceRoute when RTM is out!
// sb: this code is a workaround for an issue with wcf routes conflicting with
// mvc routes
// http://stackoverflow.com/questions/7225887/wcf-web-api-service-routes-conflicting-with-regular-asp-net-mvc-routes

// register route

 

 

 

 var config = new HttpHostConfiguration().SetErrorHandler<BadRequestErrorHandler>().AddMessageHandlers(typeof(AuthenticationMessageHandler));
 
var factory = new HttpConfigurableServiceHostFactory(config);
 routes.Add(
new WebApiRoute("api/test", factory, typeof(TestService)));

 From within the AuthenticationMessageHandler I throw an exception, however my HttpBadRequestErrorHandler.OnHandleError is never hit.

What am I doing wrong?

 

 

 
Coordinator
Sep 7, 2011 at 5:12 AM

It's a known issue, we are fixing it.