Commit 7a68333c authored by Mygod's avatar Mygod

Misc refinements

parent d012ab30
......@@ -415,8 +415,8 @@ object BaseService {
} catch (_: VpnService.NullConnectionException) {
stopRunner(true, getString(R.string.reboot_required))
} catch (exc: Throwable) {
stopRunner(true, "${getString(R.string.service_failed)}: ${exc.message}")
printLog(exc)
stopRunner(true, "${getString(R.string.service_failed)}: ${exc.message}")
}
}
return Service.START_NOT_STICKY
......
......@@ -63,8 +63,9 @@ object ProfileManager {
@Throws(IOException::class)
fun getProfile(id: Long): Profile? = try {
PrivateDatabase.profileDao[id]
} catch (ex: SQLiteCantOpenDatabaseException) {
throw IOException(ex)
} catch (ex: SQLException) {
if (ex.cause is SQLiteCantOpenDatabaseException) throw IOException(ex)
printLog(ex)
null
}
......@@ -79,8 +80,9 @@ object ProfileManager {
@Throws(IOException::class)
fun isNotEmpty(): Boolean = try {
PrivateDatabase.profileDao.isNotEmpty()
} catch (ex: SQLiteCantOpenDatabaseException) {
throw IOException(ex)
} catch (ex: SQLException) {
if (ex.cause is SQLiteCantOpenDatabaseException) throw IOException(ex)
printLog(ex)
false
}
......@@ -88,8 +90,9 @@ object ProfileManager {
@Throws(IOException::class)
fun getAllProfiles(): List<Profile>? = try {
PrivateDatabase.profileDao.list()
} catch (ex: SQLiteCantOpenDatabaseException) {
throw IOException(ex)
} catch (ex: SQLException) {
if (ex.cause is SQLiteCantOpenDatabaseException) throw IOException(ex)
printLog(ex)
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