Improve error messages

This commit is contained in:
Him188 2020-11-16 15:42:23 +08:00
parent b7b9149a06
commit 0e88990b13

View File

@ -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.")
} }
} }