-
Notifications
You must be signed in to change notification settings - Fork 0
/
exceptions.py
36 lines (31 loc) · 1.18 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
class fileNotFoundWarning(RuntimeWarning):
def __init__(self, filename):
self.f = filename
def __str__(self):
return 'File %s not found!' % self.f
class fileNotFoundError(RuntimeError):
def __init__(self, filename):
self.f = filename
def __str__(self):
return 'File %s not found, please exit manually and fix problem (or maybe just refresh the database)!' % self.f
class notMainError(RuntimeError):
def __init__(self):
pass
def __str__(self):
return 'Program is not ran as __main__, please re-run it!'
class deprecatedMethodWarning(PendingDeprecationWarning):
def __init__(self, oldn, newn):
self.oldn = oldn
self.newn = newn
def __str__(self):
return 'Method %s will be deprecated soon, use %s instead.' % (self.oldn, self.newn)
class multipleOptionsError(RuntimeError):
def __init__(self, opt:str)->None:
self.opt = opt
def __str__(self)->str:
return 'You specified the same option \'%s\' multiple times!'%(self.opt)
class wrongOptionError(RuntimeError):
def __init__(self)->None:
pass
def __str__(self)->str:
return 'Wrong option format, check menuals.'