Back in RC1, I would do this:
[HttpPost] public IActionResult Post([FromBody]string something) { try{ // ... } catch(Exception e)
return StatusCode((int)HttpStatusCode.InternalServerError, e);
Should be used in non-ASP.NET contexts (see other answers for ASP.NET Core).
HttpStatusCode is an enumeration in System.Net.
HttpStatusCode
System.Net