Why are status codes like 400/500 not presented in the Error? object of the completionHandler? The URLSession API draws a strict line between: Transport errors, that is, errors getting your request too the server or getting the response backServer-side errors, that is, the HTTP status code in the response from the serverThe main reason for this is that the interpretation of server errors can be server specific, and that makes things hard for a generic HTTP client, like URLSession, that has to work with all servers. If this setup is inconvenient to you, it’s quite straightforward to add your own wrapper to make things easier. For example, pasted in below is an extension on URLSession that treats anything except 200...299 as an error. Note This code uses the Swift 5 Result type, and thus requires Xcode 10.2 beta. If you need Swift 4 compatibility, you can use your own Result type (or the one from your favourite third-party library). Is ther