From 97811928a7bd1d459387eadab8264a7fedfd1649 Mon Sep 17 00:00:00 2001 From: Mygod Date: Sun, 17 Feb 2019 12:26:42 +0800 Subject: [PATCH] More informative unexpected output exception --- mobile/src/main/java/be/mygod/vpnhotspot/net/DhcpWorkaround.kt | 3 ++- mobile/src/main/java/be/mygod/vpnhotspot/net/Routing.kt | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/DhcpWorkaround.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/DhcpWorkaround.kt index 3ee3e27d..9e304b01 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/DhcpWorkaround.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/DhcpWorkaround.kt @@ -5,6 +5,7 @@ import be.mygod.vpnhotspot.App.Companion.app import be.mygod.vpnhotspot.util.RootSession import be.mygod.vpnhotspot.widget.SmartSnackbar import timber.log.Timber +import java.io.IOException /** * Assuming RULE_PRIORITY_VPN_OUTPUT_TO_LOCAL = 11000. @@ -33,7 +34,7 @@ object DhcpWorkaround : SharedPreferences.OnSharedPreferenceChangeListener { } else { e.result.err.joinToString("\n") == "RTNETLINK answers: No such file or directory" }) return - Timber.w(e) + Timber.w(IOException("Failed to tweak dhcp workaround rule", e)) SmartSnackbar.make(e).show() } catch (e: Exception) { Timber.w(e) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/Routing.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/Routing.kt index 5926dae4..7b5ba78d 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/Routing.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/Routing.kt @@ -13,6 +13,7 @@ import be.mygod.vpnhotspot.util.computeIfAbsentCompat import be.mygod.vpnhotspot.widget.SmartSnackbar import kotlinx.coroutines.runBlocking import timber.log.Timber +import java.io.IOException import java.net.* /** @@ -238,7 +239,7 @@ class Routing(private val caller: Any, private val downstream: String) : IpNeigh "ndc ipfwd disable vpnhotspot_$downstream") return } catch (e: RootSession.UnexpectedOutputException) { - Timber.w(e) + Timber.w(IOException("ndc ipfwd enable failure", e)) } transaction.exec("echo 1 >/proc/sys/net/ipv4/ip_forward") }