49 lines
1.3 KiB
Python
49 lines
1.3 KiB
Python
|
from typing import Union
|
||
|
|
||
|
from bson import ObjectId
|
||
|
|
||
|
|
||
|
class GuildNotFoundError(Exception):
|
||
|
"""Exception raised when guild does not exist in a database.
|
||
|
|
||
|
### Attributes:
|
||
|
* id (`Union[int, ObjectId]`): Guild ID.
|
||
|
"""
|
||
|
|
||
|
def __init__(self, id: Union[int, ObjectId]):
|
||
|
self.id: Union[int, ObjectId] = id
|
||
|
super().__init__(f"Could not find guild entry for {str(id)}.")
|
||
|
|
||
|
def __str__(self):
|
||
|
return f"Could not find guild entry for {str(self.id)}."
|
||
|
|
||
|
|
||
|
class GuildAlreadyExistsError(Exception):
|
||
|
"""Exception raised when guild already exists in a database.
|
||
|
|
||
|
### Attributes:
|
||
|
* id (`Union[int, ObjectId]`): Guild ID.
|
||
|
"""
|
||
|
|
||
|
def __init__(self, id: Union[int, ObjectId]):
|
||
|
self.id: Union[int, ObjectId] = id
|
||
|
super().__init__(f"There already is a database entry for {str(id)}.")
|
||
|
|
||
|
def __str__(self):
|
||
|
return f"There already is a database entry for {str(self.id)}."
|
||
|
|
||
|
|
||
|
class GuildChallengesEmptyError(Exception):
|
||
|
"""Exception raised when guild has no active challenges.
|
||
|
|
||
|
### Attributes:
|
||
|
* id (`ObjectId`): Guild ID.
|
||
|
"""
|
||
|
|
||
|
def __init__(self, id: ObjectId):
|
||
|
self.id: ObjectId = id
|
||
|
super().__init__(f"Guild {str(id)} has no active challenges.")
|
||
|
|
||
|
def __str__(self):
|
||
|
return f"Guild {str(self.id)} has no active challenges."
|