Ktor client cannot catch offline exceptions (Kotlin Multiplatform)
See original GitHub issueKtor Version
1.2.0
Ktor Engine Used(client or server and name)
IOS Client
JVM Version, Operating System and Relevant Context
iOS - Airplane mode
Feedback
Tried to catch offline mode exception in case the internet connection is dropped. The errors showed up in the logs but cannot be caught in Multiplatform common project. Haven’t tried on Android yet.
2019-06-03 16:02:17.432609+0800 XApp[1558:1117673] Task <449DDD76-DA3D-42B4-9CA4-ECEA0B218850>.<1> load failed with error Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." UserInfo={_kCFStreamErrorCodeKey=50, NSUnderlyingError=0x282e59d40 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 "(null)" UserInfo={_kCFStreamErrorCodeKey=50, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <449DDD76-DA3D-42B4-9CA4-ECEA0B218850>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <449DDD76-DA3D-42B4-9CA4-ECEA0B218850>.<1>"
), NSLocalizedDescription=The Internet connection appears to be offline., NSErrorFailingURLStringKey=https://localhost/?page=1&ordering=modified&search=, NSErrorFailingURLKey=https://localhost/?page=1&ordering=modified&search=, _kCFStreamErrorDomainKey=1} [-1009]
Issue Analytics
- State:
- Created 4 years ago
- Reactions:13
- Comments:14 (1 by maintainers)
Top Results From Across the Web
Client: Handle network exceptions in the commonMain module
Hi everyone,. using ktor-client in a Kotlin multiplatform project, how can you deal/detect network errors? Detecting status code or serialization issues can be ......
Read more >Handle response http code and exceptions with Ktor
I've tested your scenario with this sample class (got and modified from official ktor github rep) and I can hit all breakpoints where...
Read more >WhatsNew 2.1 | Ktor Framework
Ktor client native ignores try/catch: "kotlin.coroutines.cancellation.CancellationException: StandaloneCoroutine was cancelled".
Read more >Handle Response Http Code And Exceptions With Ktor
In this tutorial, you'll learn how to use Kotlin Multiplatform and build an ... Ktor client cannot catch offline exceptions (Kotlin Multiplatform) #1165....
Read more >Shared Library in Kotlin Multiplatform - Karumi Blog
Check out the first steps into Kotlin Multiplatform, ... are still present like issue #1165: Ktor client cannot catch offline exceptions and ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@e5l when it’s going to be released the fix?
I have the same problem, @LiewJunTung how did you catch this exception?
In Android is working fine, but in IOS crashes, seems a problem of
IosClientEngine
and the delegate protocol.