Skip to content

Commit

Permalink
Refine error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Mygod committed Dec 19, 2024
1 parent b218834 commit 5c3fbf0
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class LocationSetter(appContext: Context, workerParams: WorkerParameters) : Coro
}
error.getString("message")
}
} catch (e: JSONException) {
} catch (_: JSONException) {
response
})
return shouldWarn
Expand All @@ -130,7 +130,7 @@ class LocationSetter(appContext: Context, workerParams: WorkerParameters) : Coro
val obj = JSONObject(response)
val webhook = obj.getJSONObject("data").optJSONObject("webhook")
if (webhook == null) {
if (notifyErrors(response, obj)) Timber.w(response) else Timber.w(Exception(response))
if (notifyErrors(response, obj)) Timber.w(Exception(response)) else Timber.w(response)
return Result.retry()
}
if (webhook["human"] == JSONObject.NULL) {
Expand Down Expand Up @@ -177,8 +177,8 @@ class LocationSetter(appContext: Context, workerParams: WorkerParameters) : Coro
Result.failure()
} else {
if (code == 502 || code == 522 || code == 523) {
Timber.d(Exception(error + code))
} else Timber.w(Exception(error + code))
Timber.d(Exception("$code $error"))
} else Timber.w(Exception("$code $error"))
Result.retry()
}
}
Expand Down

0 comments on commit 5c3fbf0

Please sign in to comment.