Commit 7a68333c authored by Mygod's avatar Mygod

Misc refinements

parent d012ab30
...@@ -415,8 +415,8 @@ object BaseService { ...@@ -415,8 +415,8 @@ object BaseService {
} catch (_: VpnService.NullConnectionException) { } catch (_: VpnService.NullConnectionException) {
stopRunner(true, getString(R.string.reboot_required)) stopRunner(true, getString(R.string.reboot_required))
} catch (exc: Throwable) { } catch (exc: Throwable) {
stopRunner(true, "${getString(R.string.service_failed)}: ${exc.message}")
printLog(exc) printLog(exc)
stopRunner(true, "${getString(R.string.service_failed)}: ${exc.message}")
} }
} }
return Service.START_NOT_STICKY return Service.START_NOT_STICKY
......
...@@ -63,8 +63,9 @@ object ProfileManager { ...@@ -63,8 +63,9 @@ object ProfileManager {
@Throws(IOException::class) @Throws(IOException::class)
fun getProfile(id: Long): Profile? = try { fun getProfile(id: Long): Profile? = try {
PrivateDatabase.profileDao[id] PrivateDatabase.profileDao[id]
} catch (ex: SQLiteCantOpenDatabaseException) {
throw IOException(ex)
} catch (ex: SQLException) { } catch (ex: SQLException) {
if (ex.cause is SQLiteCantOpenDatabaseException) throw IOException(ex)
printLog(ex) printLog(ex)
null null
} }
...@@ -79,8 +80,9 @@ object ProfileManager { ...@@ -79,8 +80,9 @@ object ProfileManager {
@Throws(IOException::class) @Throws(IOException::class)
fun isNotEmpty(): Boolean = try { fun isNotEmpty(): Boolean = try {
PrivateDatabase.profileDao.isNotEmpty() PrivateDatabase.profileDao.isNotEmpty()
} catch (ex: SQLiteCantOpenDatabaseException) {
throw IOException(ex)
} catch (ex: SQLException) { } catch (ex: SQLException) {
if (ex.cause is SQLiteCantOpenDatabaseException) throw IOException(ex)
printLog(ex) printLog(ex)
false false
} }
...@@ -88,8 +90,9 @@ object ProfileManager { ...@@ -88,8 +90,9 @@ object ProfileManager {
@Throws(IOException::class) @Throws(IOException::class)
fun getAllProfiles(): List<Profile>? = try { fun getAllProfiles(): List<Profile>? = try {
PrivateDatabase.profileDao.list() PrivateDatabase.profileDao.list()
} catch (ex: SQLiteCantOpenDatabaseException) {
throw IOException(ex)
} catch (ex: SQLException) { } catch (ex: SQLException) {
if (ex.cause is SQLiteCantOpenDatabaseException) throw IOException(ex)
printLog(ex) printLog(ex)
null null
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment