mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-11 00:23:42 -04:00
warn if update check is unavailable du to client error
"no network available"
This commit is contained in:
parent
e54623021f
commit
8e2bb9fc98
@ -86,7 +86,7 @@ object Eros {
|
||||
start()
|
||||
}
|
||||
}
|
||||
MinosoftUpdater::update.observe(this) {
|
||||
MinosoftUpdater::update.observe(this, true) {
|
||||
if (it == null) return@observe
|
||||
if (it.id == OtherProfileManager.selected.updater.dismiss) return@observe // TODO: if not searched manually
|
||||
UpdateAvailableDialog(it).show()
|
||||
|
@ -20,8 +20,12 @@ import de.bixilon.kutil.url.URLUtil.toURL
|
||||
import de.bixilon.minosoft.config.profile.profiles.other.OtherProfileManager
|
||||
import de.bixilon.minosoft.properties.MinosoftProperties
|
||||
import de.bixilon.minosoft.util.http.HTTP2.get
|
||||
import de.bixilon.minosoft.util.http.HTTPResponse
|
||||
import de.bixilon.minosoft.util.http.exceptions.HTTPException
|
||||
import de.bixilon.minosoft.util.json.Jackson
|
||||
import de.bixilon.minosoft.util.logging.Log
|
||||
import de.bixilon.minosoft.util.logging.LogLevels
|
||||
import de.bixilon.minosoft.util.logging.LogMessageType
|
||||
import java.net.URL
|
||||
|
||||
object MinosoftUpdater {
|
||||
@ -68,7 +72,13 @@ object MinosoftUpdater {
|
||||
}
|
||||
|
||||
private fun request(url: String): MinosoftUpdate? {
|
||||
val response = url.get({ it })
|
||||
val response: HTTPResponse<String>
|
||||
try {
|
||||
response = url.get({ it })
|
||||
} catch (error: Throwable) {
|
||||
Log.log(LogMessageType.OTHER, LogLevels.WARN) { "Could not check for updates: $error" }
|
||||
return null
|
||||
}
|
||||
|
||||
return when (response.statusCode) {
|
||||
204 -> null
|
||||
|
Loading…
x
Reference in New Issue
Block a user