6
6
7
7
8
8
r"""`error` Exception classes raised by Kepconfig.
9
- Includes KepURLError and KepHTTPError
9
+ Includes KepError, KepURLError and KepHTTPError
10
10
"""
11
11
12
12
__all__ = ['KepError' , 'KepURLError' , 'KepHTTPError' ]
@@ -24,10 +24,13 @@ def __str__(self):
24
24
class KepURLError (KepError ):
25
25
'''Exception class raised by Kepconfig that inherits responses from the urllib URLError exceptions.
26
26
'''
27
- def __init__ (self , reason , url ):
28
- KepError .__init__ (self )
29
- self .reason = reason
27
+ def __init__ (self , url = None , * args , ** kwargs ):
28
+ super ().__init__ (* args , ** kwargs )
30
29
self .url = url
30
+
31
+ @property
32
+ def reason (self ):
33
+ return self .msg
31
34
32
35
def __str__ (self ):
33
36
return '<urlopen error %s>' % self .reason
@@ -39,8 +42,8 @@ class KepHTTPError(KepError):
39
42
code, headers, and a body. In some contexts,an application may want to
40
43
handle an exception like a regular response.
41
44
'''
42
- def __init__ (self , url , code , msg , hdrs , payload ):
43
- KepError .__init__ (self , msg )
45
+ def __init__ (self , url = None , code = None , hdrs = None , payload = None , * args , ** kwargs ):
46
+ super () .__init__ (* args , ** kwargs )
44
47
self .url = url
45
48
self .code = code
46
49
self .hdrs = hdrs
0 commit comments