66
77
88r"""`error` Exception classes raised by Kepconfig.
9- Includes KepURLError and KepHTTPError
9+ Includes KepError, KepURLError and KepHTTPError
1010"""
1111
1212__all__ = ['KepError' , 'KepURLError' , 'KepHTTPError' ]
@@ -24,10 +24,13 @@ def __str__(self):
2424class KepURLError (KepError ):
2525 '''Exception class raised by Kepconfig that inherits responses from the urllib URLError exceptions.
2626 '''
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 )
3029 self .url = url
30+
31+ @property
32+ def reason (self ):
33+ return self .msg
3134
3235 def __str__ (self ):
3336 return '<urlopen error %s>' % self .reason
@@ -39,8 +42,8 @@ class KepHTTPError(KepError):
3942 code, headers, and a body. In some contexts,an application may want to
4043 handle an exception like a regular response.
4144 '''
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 )
4447 self .url = url
4548 self .code = code
4649 self .hdrs = hdrs
0 commit comments