title: HttpMediaTypeNotAcceptableException for errors with text/plain message response?
body: <p>I have a simple webservice that returns content either as <code>json</code> or as <code>plain text</code> (depending on the clients' <code>accept</code> http header).</p>
  
  <p>Problem: if an error occurs during <code>text/plain</code> request, Spring somehow returns a <code>406 Not Acceptable</code>. Which is kind of wrong, because spring could as well just write the error out as plain error text, and moreover should absolutely preserve the <code>400</code> error status:</p>
  
  <pre><code>@RestController
  public class TestServlet {
      @PostMapping(value = "/test", produces = {APPLICATION_JSON_VALUE, TEXT_PLAIN_VALUE, "text/csv"})
      public Object post() {
          throw new BadRequestException("bad req");
      }
  }
  
  @ResponseStatus(HttpStatus.BAD_REQUEST)
  public class BadRequestException extends RuntimeException {
      public BadRequestException(String msg) {
          super(msg);
      }
  }
  </code></pre>
  
  <p>POST request with <code>accept=application/json</code>:</p>
  
  <pre><code>{
      "timestamp": "2018-07-30T14:26:02",
      "status": 400,
      "error": "Bad Request",
      "message": "bad req",
      "path": "/test"
  }
  </code></pre>
  
  <p>BUT with <code>accept=text/csv</code> (or <code>text/plain</code>) shows an empty response with status <code>406 Not Acceptable</code>.</p>
  
  <p>I also noticed the <code>DispatcherServlet.processDispatchResult()</code> is called twice: first with my <code>BadRequest</code> exception, 2nd time with <code>HttpMediaTypeNotAcceptableException</code>. So clearly the rendering of my custom exception fails, but why?</p>