Skip to content

Commit 5c3fbf0

Browse files
committed
Refine error handling
1 parent b218834 commit 5c3fbf0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

app/src/main/java/be/mygod/reactmap/follower/LocationSetter.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class LocationSetter(appContext: Context, workerParams: WorkerParameters) : Coro
117117
}
118118
error.getString("message")
119119
}
120-
} catch (e: JSONException) {
120+
} catch (_: JSONException) {
121121
response
122122
})
123123
return shouldWarn
@@ -130,7 +130,7 @@ class LocationSetter(appContext: Context, workerParams: WorkerParameters) : Coro
130130
val obj = JSONObject(response)
131131
val webhook = obj.getJSONObject("data").optJSONObject("webhook")
132132
if (webhook == null) {
133-
if (notifyErrors(response, obj)) Timber.w(response) else Timber.w(Exception(response))
133+
if (notifyErrors(response, obj)) Timber.w(Exception(response)) else Timber.w(response)
134134
return Result.retry()
135135
}
136136
if (webhook["human"] == JSONObject.NULL) {
@@ -177,8 +177,8 @@ class LocationSetter(appContext: Context, workerParams: WorkerParameters) : Coro
177177
Result.failure()
178178
} else {
179179
if (code == 502 || code == 522 || code == 523) {
180-
Timber.d(Exception(error + code))
181-
} else Timber.w(Exception(error + code))
180+
Timber.d(Exception("$code $error"))
181+
} else Timber.w(Exception("$code $error"))
182182
Result.retry()
183183
}
184184
}

0 commit comments

Comments
 (0)