Catch IOException
This commit is contained in:
@@ -25,6 +25,7 @@ import be.mygod.vpnhotspot.net.TetheringManager
|
|||||||
import be.mygod.vpnhotspot.net.wifi.WifiApManager
|
import be.mygod.vpnhotspot.net.wifi.WifiApManager
|
||||||
import be.mygod.vpnhotspot.widget.SmartSnackbar
|
import be.mygod.vpnhotspot.widget.SmartSnackbar
|
||||||
import com.crashlytics.android.Crashlytics
|
import com.crashlytics.android.Crashlytics
|
||||||
|
import java.io.IOException
|
||||||
import java.lang.reflect.InvocationTargetException
|
import java.lang.reflect.InvocationTargetException
|
||||||
|
|
||||||
sealed class TetherManager(protected val parent: TetheringFragment) : Manager(),
|
sealed class TetherManager(protected val parent: TetheringFragment) : Manager(),
|
||||||
@@ -57,6 +58,11 @@ sealed class TetherManager(protected val parent: TetheringFragment) : Manager(),
|
|||||||
val started = manager.isStarted
|
val started = manager.isStarted
|
||||||
try {
|
try {
|
||||||
if (started) manager.stop() else manager.start()
|
if (started) manager.stop() else manager.start()
|
||||||
|
} catch (e: IOException) {
|
||||||
|
e.printStackTrace()
|
||||||
|
Crashlytics.logException(e)
|
||||||
|
Toast.makeText(mainActivity, e.localizedMessage, Toast.LENGTH_LONG).show()
|
||||||
|
ManageBar.start(itemView.context)
|
||||||
} catch (e: InvocationTargetException) {
|
} catch (e: InvocationTargetException) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
Crashlytics.logException(e)
|
Crashlytics.logException(e)
|
||||||
@@ -64,7 +70,7 @@ sealed class TetherManager(protected val parent: TetheringFragment) : Manager(),
|
|||||||
while (cause != null) {
|
while (cause != null) {
|
||||||
cause = cause.cause
|
cause = cause.cause
|
||||||
if (cause != null && cause !is InvocationTargetException) {
|
if (cause != null && cause !is InvocationTargetException) {
|
||||||
Toast.makeText(mainActivity, cause.message.toString(), Toast.LENGTH_LONG).show()
|
Toast.makeText(mainActivity, cause.localizedMessage, Toast.LENGTH_LONG).show()
|
||||||
ManageBar.start(itemView.context)
|
ManageBar.start(itemView.context)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user