mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-10 16:01:50 -04:00
properly warn if update checking failed
This commit is contained in:
parent
f61a6a5981
commit
d77bb34162
@ -68,7 +68,7 @@ class AboutController : EmbeddedJavaFXController<HBox>() {
|
|||||||
checkUpdatesFX.isDisable = true
|
checkUpdatesFX.isDisable = true
|
||||||
DefaultThreadPool += {
|
DefaultThreadPool += {
|
||||||
try {
|
try {
|
||||||
val update = MinosoftUpdater.check()
|
val update = MinosoftUpdater.check(error = true)
|
||||||
if (update == null) {
|
if (update == null) {
|
||||||
InfoDialog(i18n("updater.none.title"), i18n("updater.none.header")).show()
|
InfoDialog(i18n("updater.none.title"), i18n("updater.none.header")).show()
|
||||||
}
|
}
|
||||||
|
@ -54,13 +54,13 @@ object MinosoftUpdater {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun check(): MinosoftUpdate? {
|
fun check(error: Boolean = false): MinosoftUpdate? {
|
||||||
val profile = OtherProfileManager.selected.updater
|
val profile = OtherProfileManager.selected.updater
|
||||||
return check(profile.url, profile.channel)
|
return check(profile.url, profile.channel, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun check(url: String, channel: String): MinosoftUpdate? {
|
fun check(url: String, channel: String, error: Boolean): MinosoftUpdate? {
|
||||||
val commit = MinosoftProperties.git?.commit ?: ""
|
val commit = MinosoftProperties.git?.commit ?: ""
|
||||||
val version = MinosoftProperties.general.name
|
val version = MinosoftProperties.general.name
|
||||||
val stable = MinosoftProperties.general.stable
|
val stable = MinosoftProperties.general.stable
|
||||||
@ -77,17 +77,18 @@ object MinosoftUpdater {
|
|||||||
)
|
)
|
||||||
|
|
||||||
validateURL(request.toURL())
|
validateURL(request.toURL())
|
||||||
val update = request(request)
|
val update = request(request, error)
|
||||||
this.update = update
|
this.update = update
|
||||||
return update
|
return update
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun request(url: String): MinosoftUpdate? {
|
private fun request(url: String, error: Boolean): MinosoftUpdate? {
|
||||||
val response: HTTPResponse<String>
|
val response: HTTPResponse<String>
|
||||||
try {
|
try {
|
||||||
response = url.get({ it })
|
response = url.get({ it })
|
||||||
} catch (error: Throwable) {
|
} catch (exception: Throwable) {
|
||||||
Log.log(LogMessageType.OTHER, LogLevels.WARN) { "Could not check for updates: $error" }
|
Log.log(LogMessageType.OTHER, LogLevels.WARN) { "Could not check for updates: $exception" }
|
||||||
|
if (error) throw exception
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user