From b5fcbe99fb1f3a667f6f824b2549d5415534c750 Mon Sep 17 00:00:00 2001 From: Karlatemp Date: Sat, 3 Dec 2022 19:30:15 +0800 Subject: [PATCH] [core] Improve error message of NormalMember.modifyAdmin(); #2370 --- .../commonMain/kotlin/contact/NormalMemberImpl.kt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mirai-core/src/commonMain/kotlin/contact/NormalMemberImpl.kt b/mirai-core/src/commonMain/kotlin/contact/NormalMemberImpl.kt index e49b1bb84..954cb9654 100644 --- a/mirai-core/src/commonMain/kotlin/contact/NormalMemberImpl.kt +++ b/mirai-core/src/commonMain/kotlin/contact/NormalMemberImpl.kt @@ -213,7 +213,17 @@ internal class NormalMemberImpl constructor( ) as TroopManagement.ModifyAdmin.Response check(resp.success) { - "Failed to modify admin, cause: ${resp.msg}" + buildString { + append("Failed to ") + append(if (operation) "grant" else "revoke") + append(" administrator privileges ") + append(if (operation) "to" else "from") + append(" member ") + append(id).append(" in group ").append(group.id) + + append(": code=").append(resp.code) + append(", msg=").append(resp.msg) + } } this@NormalMemberImpl.permission = new