Update XLog

This commit is contained in:
Jobobby04
2020-11-25 15:57:05 -05:00
parent fcc2b1773b
commit 643aa377bf
30 changed files with 79 additions and 89 deletions
@@ -129,7 +129,7 @@ class ApiMangaParser(private val langs: List<String>) {
if (tags.isNotEmpty()) tags.clear()
tags += genres.map { RaisedTag(null, it, MangaDexSearchMetadata.TAG_TYPE_DEFAULT) }
} catch (e: Exception) {
XLog.e(e)
XLog.tag("ApiMangaParser").enableStackTrace(2).e(e)
throw e
}
}
@@ -239,7 +239,7 @@ class ApiMangaParser(private val langs: List<String>) {
val jsonObject = Json.decodeFromString<JsonObject>(body)
return jsonObject["manga_id"]?.jsonPrimitive?.intOrNull ?: throw Exception("No manga associated with chapter")
} catch (e: Exception) {
XLog.e(e)
XLog.tag("ApiMangaParser").enableStackTrace(2).e(e)
throw e
}
}
@@ -51,7 +51,7 @@ class FollowsHandler(val client: OkHttpClient, val headers: Headers, val prefere
response.body?.string().orEmpty()
)
} catch (e: Exception) {
XLog.e("error parsing follows", e)
XLog.tag("FollowsHandler").enableStackTrace(2).e("error parsing follows", e)
FollowsPageResult()
}
@@ -81,7 +81,7 @@ class FollowsHandler(val client: OkHttpClient, val headers: Headers, val prefere
response.body?.string().orEmpty()
)
} catch (e: Exception) {
XLog.e("error parsing follows", e)
XLog.tag("FollowsHandler").enableStackTrace(2).e("error parsing follows", e)
FollowsPageResult()
}
val track = Track.create(TrackManager.MDLIST)
@@ -158,7 +158,7 @@ class FollowsHandler(val client: OkHttpClient, val headers: Headers, val prefere
val mangaID = MdUtil.getMangaId(track.tracking_url)
val formBody = FormBody.Builder()
.add("chapter", track.last_chapter_read.toString())
XLog.d("chapter to update %s", track.last_chapter_read.toString())
XLog.tag("FollowsHandler").d("chapter to update %s", track.last_chapter_read.toString())
val response = client.newCall(
POST(
"${MdUtil.baseUrl}/ajax/actions.ajax.php?function=edit_progress&id=$mangaID",
@@ -27,7 +27,7 @@ class MangaHandler(val client: OkHttpClient, val headers: Headers, val langs: Li
val jsonData = withContext(Dispatchers.IO) { response.body!!.string() }
if (response.code != 200) {
XLog.e("error from MangaDex with response code ${response.code} \n body: \n$jsonData")
XLog.tag("MangaHandler").enableStackTrace(2).e("error from MangaDex with response code ${response.code} \n body: \n$jsonData")
throw Exception("Error from MangaDex Response code ${response.code} ")
}
@@ -118,7 +118,7 @@ class SimilarUpdateService(
// Unsubscribe from any previous subscription if needed.
job?.cancel()
val handler = CoroutineExceptionHandler { _, exception ->
XLog.e(exception)
XLog.tag("SimilarUpdateService").enableStackTrace(2).e(exception)
stopSelf(startId)
showResultNotification(true)
cancelProgressNotification()