https://kotlinlang.org logo
#ktor
Title
# ktor
o

okarm

04/10/2021, 6:27 PM
Does Ktor always throw a subclass of
RuntimeException
? Edit: nope, just found the
BadContentTypeException : Exception
.
try { client.request() } catch(e: Exception)
it is then.
c

cy

04/11/2021, 7:28 AM
What did such impression first? Why did you think so?
c

cy

04/11/2021, 10:17 AM
Well, in Kotlin there is no big difference between Exception and RuntimeException, so there is no reason to make them all runtime exceptions
o

okarm

04/11/2021, 10:21 AM
Originally I was looking for a way to catch everything that could be expected to throw from
HttpClient.request
without resorting to
catch(e: Exception)
. But that catches also the unexpected stuff. Like on the JVM I'd catch
IOException
from an IO framework.
2 Views