Alamofire: Network error vs invalid status code?
<p>Using Alamofire 4/Swift 3 how can you differentiate between a request that fails due to:</p>

<ol>
<li>Network connectivity (host down, can't reach host) vs </li>
<li>Invalid server HTTP response code (ie: 499) which causes the Alamofire request to fail due to calling <code>validate()</code>? </li>
</ol>

<p>Code:</p>

<pre><code>    sessionManager.request(url, method: .post, parameters:dict, encoding: JSONEncoding.default)
        .validate() //Validate status code
        .responseData { response in

        if response.result.isFailure {
               //??NETWORK ERROR OR INVALID SERVER RESPONSE??
        }
    }
</code></pre>

<p>We want to handle each case differently.  In the latter case we want to interrogate the response.  (In the former we don't as there is no response).</p>