I am trying to implement multiple HttpErrorHandlers and am running into trouble getting the desired behavior. It appears that the handlers are called in the order they are added but this seems to be highly subjective, especially in my case.
I am using MEF to inject a list of HttpErrorHandlers into my bootstrapper which creates the WebApiConfiguration and adds the handlers from the injected list.
One of my handlers is used to simply log the exception information. I need this handler to run before any handler that might actually handle the exception. The OnTryProvideResponse method in the LoggingErrorHandler return false which allows other handlers
to process the exception but this handler does not appears first in the list so it is never called when my other handlers return true to indicate that the exception has been handled and the response is ready to send to the client.
What suggestions can you make, given the use of MEF, to help control the order of the error handlers so I can be sure my LoggingErrorHandler is called first?