Skip to content

Commit

Permalink
improve group error
Browse files Browse the repository at this point in the history
  • Loading branch information
nakajima committed Feb 7, 2024
1 parent a5eacd3 commit 7ef5510
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion Sources/XMTPiOS/Conversations.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 7ef5510

Please sign in to comment.