prof18 / RSS-Parser

A Kotlin Multiplatform library to parse a RSS Feed

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fatal Exception: com.prof18.rssparser.exception.HttpException

saldous opened this issue · comments

Updated my app from v5.0.3 to 6.0.1 and suddenly getting this from some user logs:

Fatal Exception: com.prof18.rssparser.exception.HttpException:
       at com.prof18.rssparser.internal.JvmXmlFetcher$await$2$2.onResponse(JvmXmlFetcher.kt:48)
       at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run(Thread.java:923)

I've not been able to reproduce it yet, but over 100 crash events reported in Crashlytics

Hi,
that's an expected behaviour. This exception happens if the URL returns an HTTP error not in the range from 200 to 299. The logic didn't change with the new release

@prof18 how can I catch it so it doesn't crash the app? I'm already doing:

try {
    val channel = parser.getRssChannel(feed.url)
} catch (e: Exception) {
    println(e.message)
}

yet the app is crashing

You can catch it with HttpException or Throwable!

But, I realized that HttpException extends Throwable and not Exception, that's because your try/catch didn't catch the exception. I will release a bugfix ASAP.

Thanks for reporting!

i want to fetch details in rss having following tag
<media:content url="https://images.news18.com/ibnlive/uploads/2023/08/untitled-design-2023-08-24t122426.836-16928601053x2.jpg" medium="image" height="800" width="1200"/>
how this can be done?

@TwinklingToon can you please open a new issue and provide a link to the RSS feed?