title: Return StatusCode with custom message
body: <p>I have a C# application that can throw a locked exception. I'd like to return a Microsoft.AspNetCore.Mvc.StatusCode of HttpStatusCode.Locked and add a custom message to the response.</p>
  
  <p>Currently in the controller if I use:</p>
  
  <pre><code>        [ProducesResponseType(StatusCodes.Status423Locked)]
          public async Task&lt;IActionResult&gt; GetSomething(Guid id)
          {
              try
              {
                  await MyService
                      .GetAsync(id)
                      .ConfigureAwait(false);
  
                  return Ok();
              }
              catch (IsLockedException ex)
              {
                  return StatusCode((int)HttpStatusCode.Locked, ex.Message);
              }
  </code></pre>
  
  <p>The it just returns the text of the exception message like:</p>
  
  <pre><code>The organisation 6ad1f1c0-2c47-4849-acbb-9eca56b568cf is offline.
  </code></pre>
  
  <p>However, if I change the return to:</p>
  
  <pre><code>return StatusCode((int)HttpStatusCode.Locked);
  </code></pre>
  
  <p>It will then return the following response: </p>
  
  <pre><code>{
      "status": 423,
      "traceId": "|8f3060e2-4338773910204188."
  }
  </code></pre>
  
  <p>So is there a way for me to keep both the "status" and the custom text in the response?</p>