You can try adding:
GlobalConfiguration.Configuration.IncludeErrorDetailPolicy =
IncludeErrorDetailPolicy.Always;
to your Application_Start()
in the Global.asax. This solution works for many of the common errors.
If, however, you aren't getting satisfactory information you should consider writing an l Exception Filter and registering it globally.
This article should get you started. The core of what you need is to write & register something like:
public class NotImplExceptionFilter : ExceptionFilterAttribute {
public override void OnException(HttpActionExecutedContext context) {
if (context.Exception is NotImplementedException) {
context.Response = new HttpResponseMessage(HttpStatusCode.NotImplemented);
}
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…