mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 08:14:00 +02:00
Add last detected error in diag optional
This commit is contained in:
parent
0440835013
commit
77c8494166
2 changed files with 20 additions and 0 deletions
|
|
@ -29,6 +29,7 @@ import xyz.alexcrea.cuanvil.dependency.packet.ProtocoLibWrapper
|
|||
import xyz.alexcrea.cuanvil.dependency.packet.versions.PaperPacketManager
|
||||
import xyz.alexcrea.cuanvil.enchant.CAEnchantmentRegistry
|
||||
import xyz.alexcrea.cuanvil.listener.PrepareAnvilListener
|
||||
import xyz.alexcrea.cuanvil.util.MetricsUtil
|
||||
import java.util.*
|
||||
import java.util.stream.Collectors
|
||||
|
||||
|
|
@ -59,6 +60,7 @@ class DiagnosticExecutor: CASubCommand() {
|
|||
PLUGIN_PRIVACY("plugin_privacy"),
|
||||
NO_MERGE_TEST("no_merge_test"),
|
||||
FULL_ENCHANTMENT_DATA("full_enchantment_data"),
|
||||
INCLUDE_LAST_ERROR("include_last_error"),
|
||||
}
|
||||
|
||||
private fun fetchParameters(args: Array<out String>): EnumSet<DiagParams> {
|
||||
|
|
@ -154,6 +156,8 @@ class DiagnosticExecutor: CASubCommand() {
|
|||
.append(System.getProperty("os.arch"))
|
||||
}
|
||||
|
||||
stb.append("\nHad detect error: ").append(if(MetricsUtil.lastError != null) "Yes" else "No")
|
||||
|
||||
if(!params.contains(DiagParams.PLUGIN_PRIVACY)) {
|
||||
pluginListDiag(sender, stb)
|
||||
}
|
||||
|
|
@ -168,6 +172,10 @@ class DiagnosticExecutor: CASubCommand() {
|
|||
if(params.contains(DiagParams.FULL_ENCHANTMENT_DATA)){
|
||||
fullEnchantmentData(stb)
|
||||
}
|
||||
|
||||
if(params.contains(DiagParams.INCLUDE_LAST_ERROR)){
|
||||
includeLastError(stb)
|
||||
}
|
||||
}
|
||||
|
||||
private fun testMerge(player: Player, stb: StringBuilder) {
|
||||
|
|
@ -323,5 +331,14 @@ class DiagnosticExecutor: CASubCommand() {
|
|||
}")
|
||||
|
||||
}
|
||||
|
||||
private fun includeLastError(stb: StringBuilder) {
|
||||
val e = MetricsUtil.lastError ?: return
|
||||
|
||||
stb.append("\n\nLast stack trace: ${e.stackTraceToString()}")
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -52,8 +52,11 @@ object MetricsUtil {
|
|||
FAST_STATS_METRICS?.shutdown()
|
||||
}
|
||||
|
||||
var lastError: Throwable? = null
|
||||
|
||||
fun trackError(e: Throwable) {
|
||||
ERROR_TRACKER?.trackError(e)
|
||||
lastError = e
|
||||
}
|
||||
|
||||
fun trackError(message: String) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue