42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
from typing import Union
|
|
|
|
from bson import ObjectId
|
|
|
|
|
|
class MemberNotFoundError(Exception):
|
|
"""Exception raised when member does not exist in a database.
|
|
|
|
### Attributes:
|
|
* id (`Union[int, ObjectId]`): Member ID.
|
|
* guild (`ObjectId`): Member's guild.
|
|
"""
|
|
|
|
def __init__(self, id: Union[int, ObjectId], guild: ObjectId):
|
|
self.id: Union[int, ObjectId] = id
|
|
self.guild: ObjectId = guild
|
|
super().__init__(
|
|
f"Could not find member entry for {str(id)} in the guild with id {str(guild)}."
|
|
)
|
|
|
|
def __str__(self):
|
|
return f"Could not find member entry for {str(self.id)} in the guild with id {str(self.guild)}."
|
|
|
|
|
|
class MemberAlreadyExistsError(Exception):
|
|
"""Exception raised when attempted member creation when it already exists in a database.
|
|
|
|
### Attributes:
|
|
* id (`Union[int, ObjectId]`): Member ID.
|
|
* guild (`ObjectId`): Member's guild.
|
|
"""
|
|
|
|
def __init__(self, id: Union[int, ObjectId], guild: ObjectId):
|
|
self.id: Union[int, ObjectId] = id
|
|
self.guild: ObjectId = guild
|
|
super().__init__(
|
|
f"Member entry for {str(id)} in the guild with id {str(guild)} already exists."
|
|
)
|
|
|
|
def __str__(self):
|
|
return f"Member entry for {str(self.id)} in the guild with id {str(self.guild)} already exists."
|