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

alexfacciorusso

03/29/2019, 10:48 AM
Hello everyone. I have a question that could be potentially very silly. What is the best way to handle connection errors in a multiplatform project (Android and iOS), when I make a call with Ktor?
e

e5l

03/29/2019, 4:45 PM
Hi @alexfacciorusso, you could catch the exception
The future
1.2.0
introduces
ResponseValidator
feature with custom error handlers.
a

alexfacciorusso

03/29/2019, 5:00 PM
Hi Leonid! Thank you for you response! Actually I've "stolen" that class from the repo and using it right now; so how would you catch the ios and Android offline exceptions since they are actually different ones?
g

gildor

03/30/2019, 9:44 AM
You can define expect declaration and implement it on Android and iOS and handle network state exception
3 Views