mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-11 02:50:15 +08:00
Let the console know the full stacktrace for the IllegalArgument
This commit is contained in:
parent
64790d0114
commit
4526f71cc7
@ -18,6 +18,9 @@ import net.mamoe.mirai.console.command.descriptor.CommandArgumentParserException
|
|||||||
*
|
*
|
||||||
* [message] 将会发送给指令调用方.
|
* [message] 将会发送给指令调用方.
|
||||||
*
|
*
|
||||||
|
* 如果指令调用方是 [ConsoleCommandSender],
|
||||||
|
* 还会将 [cause], [suppressedExceptions] 发送给 [ConsoleCommandSender] (如果存在)
|
||||||
|
*
|
||||||
* @see CommandArgumentParserException
|
* @see CommandArgumentParserException
|
||||||
*/
|
*/
|
||||||
public open class IllegalCommandArgumentException : IllegalArgumentException {
|
public open class IllegalCommandArgumentException : IllegalArgumentException {
|
||||||
|
@ -62,7 +62,16 @@ internal fun startupConsoleThread() {
|
|||||||
is Success -> {
|
is Success -> {
|
||||||
}
|
}
|
||||||
is IllegalArgument -> {
|
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)
|
consoleLogger.warning(result.exception)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user