More informative unexpected output exception

This commit is contained in:
Mygod
2019-02-17 12:26:42 +08:00
parent ab7a3b4ba7
commit 97811928a7
2 changed files with 4 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.util.RootSession import be.mygod.vpnhotspot.util.RootSession
import be.mygod.vpnhotspot.widget.SmartSnackbar import be.mygod.vpnhotspot.widget.SmartSnackbar
import timber.log.Timber import timber.log.Timber
import java.io.IOException
/** /**
* Assuming RULE_PRIORITY_VPN_OUTPUT_TO_LOCAL = 11000. * Assuming RULE_PRIORITY_VPN_OUTPUT_TO_LOCAL = 11000.
@@ -33,7 +34,7 @@ object DhcpWorkaround : SharedPreferences.OnSharedPreferenceChangeListener {
} else { } else {
e.result.err.joinToString("\n") == "RTNETLINK answers: No such file or directory" e.result.err.joinToString("\n") == "RTNETLINK answers: No such file or directory"
}) return }) return
Timber.w(e) Timber.w(IOException("Failed to tweak dhcp workaround rule", e))
SmartSnackbar.make(e).show() SmartSnackbar.make(e).show()
} catch (e: Exception) { } catch (e: Exception) {
Timber.w(e) Timber.w(e)

View File

@@ -13,6 +13,7 @@ import be.mygod.vpnhotspot.util.computeIfAbsentCompat
import be.mygod.vpnhotspot.widget.SmartSnackbar import be.mygod.vpnhotspot.widget.SmartSnackbar
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import timber.log.Timber import timber.log.Timber
import java.io.IOException
import java.net.* import java.net.*
/** /**
@@ -238,7 +239,7 @@ class Routing(private val caller: Any, private val downstream: String) : IpNeigh
"ndc ipfwd disable vpnhotspot_$downstream") "ndc ipfwd disable vpnhotspot_$downstream")
return return
} catch (e: RootSession.UnexpectedOutputException) { } 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") transaction.exec("echo 1 >/proc/sys/net/ipv4/ip_forward")
} }