mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-10 18:40:15 +08:00
Improve error messages
This commit is contained in:
parent
b7b9149a06
commit
0e88990b13
@ -339,7 +339,7 @@ public object ExistingMemberValueArgumentParser : InternalCommandValueArgumentPa
|
|||||||
public object PermissionIdValueArgumentParser : InternalCommandValueArgumentParserExtensions<PermissionId>() {
|
public object PermissionIdValueArgumentParser : InternalCommandValueArgumentParserExtensions<PermissionId>() {
|
||||||
override fun parse(raw: String, sender: CommandSender): PermissionId {
|
override fun parse(raw: String, sender: CommandSender): PermissionId {
|
||||||
return kotlin.runCatching { PermissionId.parseFromString(raw) }.getOrElse {
|
return kotlin.runCatching { PermissionId.parseFromString(raw) }.getOrElse {
|
||||||
illegalArgument("无法解析 $raw 为 PermissionId")
|
illegalArgument("无法解析 $raw 为权限 ID.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -348,7 +348,7 @@ public object PermitteeIdValueArgumentParser : InternalCommandValueArgumentParse
|
|||||||
override fun parse(raw: String, sender: CommandSender): PermitteeId {
|
override fun parse(raw: String, sender: CommandSender): PermitteeId {
|
||||||
return if (raw == "~") sender.permitteeId
|
return if (raw == "~") sender.permitteeId
|
||||||
else kotlin.runCatching { AbstractPermitteeId.parseFromString(raw) }.getOrElse {
|
else kotlin.runCatching { AbstractPermitteeId.parseFromString(raw) }.getOrElse {
|
||||||
illegalArgument("无法解析 $raw 为 PermissibleIdentifier")
|
illegalArgument("无法解析 $raw 为被许可人 ID.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user