mirror of https://github.com/readrops/Readrops.git
Catch JSONFeedAdapter exceptions
This commit is contained in:
parent
694ff6331e
commit
cb41f3c7ac
|
@ -1,5 +1,6 @@
|
||||||
package com.readrops.api.localfeed.json
|
package com.readrops.api.localfeed.json
|
||||||
|
|
||||||
|
import com.readrops.api.utils.ParseException
|
||||||
import com.readrops.api.utils.nextNullableString
|
import com.readrops.api.utils.nextNullableString
|
||||||
import com.readrops.db.entities.Feed
|
import com.readrops.db.entities.Feed
|
||||||
import com.squareup.moshi.FromJson
|
import com.squareup.moshi.FromJson
|
||||||
|
@ -13,6 +14,7 @@ class JSONFeedAdapter {
|
||||||
|
|
||||||
@FromJson
|
@FromJson
|
||||||
fun fromJson(reader: JsonReader): Feed {
|
fun fromJson(reader: JsonReader): Feed {
|
||||||
|
try {
|
||||||
val feed = Feed()
|
val feed = Feed()
|
||||||
reader.beginObject()
|
reader.beginObject()
|
||||||
|
|
||||||
|
@ -30,6 +32,9 @@ class JSONFeedAdapter {
|
||||||
|
|
||||||
reader.endObject()
|
reader.endObject()
|
||||||
return feed
|
return feed
|
||||||
|
} catch (e: Exception) {
|
||||||
|
throw ParseException(e.message)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
Loading…
Reference in New Issue