Returning error string from MVC6/WepApi controller
<p>The template WebApi controller in MVC6/WebApi implements an action that returns a collection for the Get method like this:</p>

<pre><code>[HttpGet]
public IEnumerable&lt;MyEntity&gt; Get()
{
    //my code to return entities
}
</code></pre>

<p>Assuming that my code to return the result throws an exception, how would I return an error message to the consumer?</p>

<p>As far as I noticed an exception would result in HTTP 500. This is fine but I would like to give the caller a message telling him what went wrong. Because of the signature of the template action I can not catch the exception and return some Http*** or <code>ObjectResult</code> instance. </p>