|
using System.Net.Http;
using System.Web.Http.Filters;
namespace WebAPIProject.Filters
{
public class ExceptionHandlingAttribute : ExceptionFilterAttribute
{
public override void OnException(HttpActionExecutedContext context)
{
//Log Critical errors
var httpResponseMessage = new HttpResponseMessage() { ReasonPhrase = context.Exception == null ? string.Empty : context.Exception.Message };
context.Response = httpResponseMessage;
//throw new HttpResponseException(httpResponseMessage);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
is a poor software developer and thinker. Presently working on a theory of "complementary perception". It's a work in progress.