Skip to content

Commit

Permalink
Fix returning error from network connection requests
Browse files Browse the repository at this point in the history
  • Loading branch information
matus-tomlein committed Jan 18, 2024
1 parent 26380a7 commit 593f513
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -361,18 +361,18 @@ class OkHttpNetworkConnection private constructor(builder: OkHttpNetworkConnecti
* @return a RequestResult
*/
private fun requestSender(request: okhttp3.Request): Int {
return try {
try {
Logger.v(TAG, "Sending request: %s", request)
TrafficStats.setThreadStatsTag(TRAFFIC_STATS_TAG)
val resp = client?.newCall(request)?.execute()
resp?.let {
resp.body?.close()
return resp.code
}
-1
return -1
} catch (e: IOException) {
Logger.e(TAG, "Request sending failed: %s", e.toString())
-1
return -1
}
}

Expand Down

0 comments on commit 593f513

Please sign in to comment.