Test yaml on save, close #203, close #191

This commit is contained in:
Him188 2020-10-24 21:37:33 +08:00
parent 321aa74a66
commit df8b819d37

View File

@ -73,7 +73,9 @@ internal open class MultiFilePluginDataStorageImpl(
public override fun store(holder: PluginDataHolder, instance: PluginData) {
getPluginDataFile(holder, instance).writeText(
kotlin.runCatching {
yaml.encodeToString(instance.updaterSerializer, Unit)
yaml.encodeToString(instance.updaterSerializer, Unit).also {
yaml.decodeAnyFromString(it) // test yaml
}
}.recoverCatching {
// Just use mainLogger for convenience.
MiraiConsole.mainLogger.warning(