From 7ef5510bd12a3eb8ed436710fd12bfcc238c595d Mon Sep 17 00:00:00 2001 From: Pat Nakajima Date: Wed, 7 Feb 2024 14:00:55 -0600 Subject: [PATCH] improve group error --- Sources/XMTPiOS/Conversations.swift | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Sources/XMTPiOS/Conversations.swift b/Sources/XMTPiOS/Conversations.swift index 1c18390a..29b407a8 100644 --- a/Sources/XMTPiOS/Conversations.swift +++ b/Sources/XMTPiOS/Conversations.swift @@ -16,8 +16,21 @@ public enum ConversationError: Error, CustomStringConvertible { } } -public enum GroupError: Error { +public enum GroupError: Error, CustomStringConvertible { case alphaMLSNotEnabled, emptyCreation, memberCannotBeSelf, memberNotRegistered([String]) + + public var description: String { + switch self { + case .alphaMLSNotEnabled: + return "GroupError.alphaMLSNotEnabled" + case .emptyCreation: + return "GroupError.emptyCreation you cannot create an empty group" + case .memberCannotBeSelf: + return "GroupError.memberCannotBeSelf you cannot add yourself to a group" + case .memberNotRegistered(let array): + return "GroupError.memberNotRegistered members not registered: \(array.joined(separator: ", "))" + } + } } /// Handles listing and creating Conversations.