This repository has been archived by the owner on Jun 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
exceptions.py
62 lines (45 loc) · 1.64 KB
/
exceptions.py
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import logging
import sys
logger = logging.getLogger('bililive-uploader')
class ConfigNotCompletedException(Exception):
path: str
def __init__(self, path: str):
super().__init__(self)
self.path = path
logger.fatal(self)
sys.exit(1)
def __str__(self):
return f"{self.__class__.__name__}: {self.path} not found in config, please check if it's set."
class ChannelNotFoundException(Exception):
msg: str
parent_area: str
sub_area: str
def __init__(self, msg='', parent_area= '', sub_area= ''):
super().__init__()
self.msg = msg
self.parent_area = parent_area
self.sub_area = sub_area
logger.error(self)
def __str__(self):
return f'{self.__class__.__name__}: {self.msg} ' \
f'{self.parent_area}-{self.sub_area} -> ?'
class UploadVideosNotFoundException(Exception):
msg: str
def __init__(self, msg=''):
super().__init__()
self.msg = msg
logger.error(self)
def __str__(self):
return f'{self.__class__.__name__}: {self.msg}'
class UnknownError(Exception):
msg: str
def __init__(self, msg):
super().__init__(self)
self.msg = msg
logger.error(self)
def __str__(self):
return f'{self.__class__.__name__}: {self.msg}\n' \
f'This error shouldn\'t happen when the bot running normally. ' \
f'You can ignore it if bot is still running normally.' \
f'It might happen when bot restarts while bililive recorder recording.' \
f'If you think it\'s a bug, please report it to the developer.'