Only render json for unhandled exceptions

Incorporate suggestions from @mikem and @surfacedamage