[Console] Track plugin file path into error stack; iTXTech/mirai-console-loader#128

This commit is contained in:
Karlatemp 2022-07-25 01:47:24 +08:00
parent 42334c42c5
commit 9a8b696132
No known key found for this signature in database
GPG Key ID: BA173CA2B9956C59

View File

@ -207,7 +207,7 @@ internal class JvmPluginClassLoaderN : URLClassLoader {
this.sharedLibrariesLogger = ctx.sharedLibrariesLoader
this.file = file
this.ctx = ctx
init0()
init1()
}
@Suppress("Since15")
@ -218,7 +218,16 @@ internal class JvmPluginClassLoaderN : URLClassLoader {
this.sharedLibrariesLogger = ctx.sharedLibrariesLoader
this.file = file
this.ctx = ctx
init0()
init1()
}
private fun init1() {
try {
init0()
} catch (e: Throwable) {
e.addSuppressed(RuntimeException("Failed to initialize new JvmPluginClassLoader, file=$file"))
throw e
}
}
private fun init0() {