-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.py
More file actions
33 lines (26 loc) · 1.25 KB
/
errors.py
File metadata and controls
33 lines (26 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# -*- coding: utf-8 -*-
from __future__ import annotations
class PlayerNotFoundError(Exception):
def __init__(self, *, username: str | None = None, uuid: str | None = None) -> None:
self.username: str | None = username
self.uuid: str | None = uuid
if username is not None and uuid is not None:
uuid = f" ({uuid})"
fmt = "Player {0}{1} not found".format(username or "", uuid or "")
super().__init__(fmt)
class ProfileNotFoundError(Exception):
def __init__(self, *, username: str | None = None, uuid: str | None = None, profile: str | None = None) -> None:
self.username: str | None = username
self.uuid: str | None = uuid
self.profile: str | None = profile
if username is not None and uuid is not None:
uuid = f" ({uuid})"
fmt = "Profile {0} for user {1}{2} not found".format(profile or "", username or "", uuid or "")
super().__init__(fmt)
class InvalidMinecraftUsername(Exception):
def __init__(self, username: str, /) -> None:
self.username: str = username
super().__init__(f"Invalid Minecraft username: {username}")
class HypixelIsDown(Exception):
def __init__(self) -> None:
super().__init__(f"Hypixel is down!")