minosoft meeta: correctly throw error when (down)loading fails

See GH-20
This commit is contained in:
Moritz Zwerger 2023-11-25 15:37:52 +01:00
parent ae7b15de10
commit 0cfb65b0c9
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -31,12 +31,15 @@ object PreFlattening {
val json: MutableJsonObject = synchronizedMapOf()
val worker = UnconditionalWorker() // TODO: kutil 1.24 add error handler
var error: Throwable? = null
val worker = UnconditionalWorker(errorHandler = { if (error == null) error = it else it.printStackTrace() })
for ((type, data) in MinosoftMeta.root) {
worker += add@{ json[type] = data.load(profile, version) ?: return@add }
}
worker.work(latch)
error?.let { throw it }
registries.load(version, json, latch)
return registries