ShowException serves HTML only when 

Rather than be concerned with whether a request is an asynchronous browser
request or not it is better to simply consider the Accept header and only serve
HTML to clients that explicitly prefer it.

This way you will not find your pure JSON API application splitting out HTML
error messages to your console when using curl :)