diff --git a/backend/mirai-console/src/command/IllegalCommandArgumentException.kt b/backend/mirai-console/src/command/IllegalCommandArgumentException.kt index 461f701d8..adc2d785b 100644 --- a/backend/mirai-console/src/command/IllegalCommandArgumentException.kt +++ b/backend/mirai-console/src/command/IllegalCommandArgumentException.kt @@ -18,6 +18,9 @@ import net.mamoe.mirai.console.command.descriptor.CommandArgumentParserException * * [message] 将会发送给指令调用方. * + * 如果指令调用方是 [ConsoleCommandSender], + * 还会将 [cause], [suppressedExceptions] 发送给 [ConsoleCommandSender] (如果存在) + * * @see CommandArgumentParserException */ public open class IllegalCommandArgumentException : IllegalArgumentException { diff --git a/frontend/mirai-console-terminal/src/ConsoleThread.kt b/frontend/mirai-console-terminal/src/ConsoleThread.kt index c82476e7f..b803b8914 100644 --- a/frontend/mirai-console-terminal/src/ConsoleThread.kt +++ b/frontend/mirai-console-terminal/src/ConsoleThread.kt @@ -62,7 +62,16 @@ internal fun startupConsoleThread() { is Success -> { } is IllegalArgument -> { - result.exception.message?.let { consoleLogger.warning(it) } ?: kotlin.run { + result.exception.message?.let { msg -> + val err = result.exception + if ((err.suppressed?.size ?: 0) != 0) { + // 该 IllegalArgument 错误还存在其他附加错误 + consoleLogger.warning(result.exception) + } else { + consoleLogger.warning(msg) + err.cause?.let { consoleLogger.warning(it) } + } + } ?: kotlin.run { consoleLogger.warning(result.exception) } }