无论如何我们可以在捕获异常时获取 HttpStatus 代码吗?例外情况可能是Bad Request
, 408 Request Timeout
, 419 Authentication Timeout
? 如何在异常块中处理这个?
catch (Exception exception)
{
techDisciplines = new TechDisciplines { Status = "Error", Error = exception.Message };
return this.Request.CreateResponse<TechDisciplines>(
HttpStatusCode.BadRequest, techDisciplines);
}