Ensure that a helpful response is always logged. Previously if there was no HTTP status code, we'd not get a log which makes debugging extra tricky. Now we always log something, and add the error body and empty message if those conditions would cause the response decode to fail.
Also, in the case where data == nil, we were returning without calling the completion handler, which, while unlikely, is bad, so I added an error completion block there too.
Now we can get something like this, instead of nothing, which is a big improvement.
Ensure that a helpful response is always logged. Previously if there was no HTTP status code, we'd not get a log which makes debugging extra tricky. Now we always log something, and add the
error
body and empty message if those conditions would cause the response decode to fail.Also, in the case where
data == nil
, we were returning without calling the completion handler, which, while unlikely, is bad, so I added an error completion block there too.Now we can get something like this, instead of nothing, which is a big improvement.