I currently use Tailscale to connect to my NAS by hostname ("nas") – this leads to the app crashing when Tailscale isn't turned on.
I'd propose catching the exception (or network exceptions in general) and displaying something like a toast notification about the connection failure.
Version: 0.10.1
Device: Xiaomi 2201123G
System: Android 14 (API 34)
Stack trace:
java.net.UnknownHostException: Unable to resolve host "nas": No address associated with hostname
at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:156)
at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:103)
at java.net.InetAddress.getAllByName(InetAddress.java:1152)
at okhttp3.Dns$Companion$DnsSystem.lookup(Dns.kt:6)
at okhttp3.internal.connection.RealRoutePlanner.plan(RealRoutePlanner.kt:469)
at okhttp3.internal.connection.FastFallbackExchangeFinder.launchTcpConnect(FastFallbackExchangeFinder.kt:10)
at okhttp3.internal.connection.FastFallbackExchangeFinder.find(FastFallbackExchangeFinder.kt:61)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:126)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:1015)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:126)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:139)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:126)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:174)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:126)
at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:96)
at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:48)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
at java.lang.Thread.run(Thread.java:1012)
Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@3245efc, Dispatchers.IO]
Caused by: android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname)
at libcore.io.Linux.android_getaddrinfo(Native Method)
at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:133)
at libcore.io.BlockGuardOs.android_getaddrinfo(BlockGuardOs.java:222)
at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:133)
at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:135)
... 19 more
1. Environment
Version: 0.10.1 Device: Xiaomi 2201123G System: Android 14 (API 34)
2. Describe the bug
I currently use Tailscale to connect to my NAS by hostname ("nas") – this leads to the app crashing when Tailscale isn't turned on.
I'd propose catching the exception (or network exceptions in general) and displaying something like a toast notification about the connection failure.