I have the following code (ok I hard-coded the message) in my Web API controllers:
catch (Exception e)
{
var errorResponse = Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "My Error message");
throw new HttpResponseException(errorResponse);
}
However, when I look at errorResponse, the ReasonPhrase is "Internal Server Error", my error message is nowhere to be found.
Why is this?
I realise I could build the HttpResponseException manually myself, but... Is there a correct way to do the above? How are others doing similar?