I've seen examples of using some of the new IHttpActionResults for OK, NotFound.
I haven't seen anything using Unauthorized()
.
my existing code looks like:
catch (SecurityException ex)
{
request.CreateResponse(HttpStatusCode.Unauthorized, ex.Message);
}
I'd like to replace it with this:
catch (SecurityException ex)
{
response = Unauthorized();
}
but I don't see any overload to pass exception details.
Also, what is the IHttpActionResult
equivalent of returning a 500 error?
catch (Exception ex)
{
response = request.CreateErrorResponse(HttpStatusCode.InternalServerError,
ex.Message);
}