-
Notifications
You must be signed in to change notification settings - Fork 0
/
my_exceptions.py
61 lines (39 loc) · 1.98 KB
/
my_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
class YouTubeErrors(Exception):
"""Base class for YouTube exceptions"""
pass
class InvalidUrlError(YouTubeErrors):
"""Exception raised if URL provided by user is invalid"""
def __init__(self, *args) -> None:
self.message = "Получить контент по присланной ссылке не вышло."
super().__init__(self.message)
class IncorrectTimingsError(YouTubeErrors):
"""Exception raised if URL provided by user is invalid"""
def __init__(self, *args) -> None:
self.message = "Присланные тайминги некорретны."
super().__init__(self.message)
class DownloadingError(YouTubeErrors):
"""Exception raised if URL provided by user is invalid"""
def __init__(self, *args) -> None:
self.message = "Скачать контент по присланной ссылке не вышло."
super().__init__(self.message)
class WeatherErrors(Exception):
"""Base class for YouTube exceptions"""
pass
class CityNotSupportedError(WeatherErrors):
"""Exception raised if user's city is not supported by API"""
def __init__(self, *args) -> None:
self.message = "Получить информацию про данный город не вышло."
super().__init__(self.message)
class VoiceConversionErrors(Exception):
"""Base class for recognizing speech errors"""
pass
class VoiceDownloadingError(VoiceConversionErrors):
"""Exception raised if an error occured while downloading voice"""
def __init__(self, *args) -> None:
self.message = "Не удалось получить сообщение с серверов Telegram."
super().__init__(self.message)
class VoiceConversionError(VoiceConversionErrors):
"""Exception raised if an error occured while recognizing speech"""
def __init__(self, *args) -> None:
self.message = "Не удалось распознать речь."
super().__init__(self.message)