##// END OF EJS Templates
win32: allow catching of both pywintypes.error and WindowsError
Bryan O'Sullivan -
r8328:91f1fe78 default
parent child Browse files
Show More
@@ -131,9 +131,15 b' class WinError(Exception):'
131 }
131 }
132
132
133 def __init__(self, err):
133 def __init__(self, err):
134 self.win_errno, self.win_function, self.win_strerror = err
134 try:
135 if self.win_strerror.endswith('.'):
135 # unpack a pywintypes.error tuple
136 self.win_strerror = self.win_strerror[:-1]
136 self.win_errno, self.win_function, self.win_strerror = err
137 except ValueError:
138 # get attributes from a WindowsError
139 self.win_errno = err.winerror
140 self.win_function = None
141 self.win_strerror = err.strerror
142 self.win_strerror = self.win_strerror.rstrip('.')
137
143
138 class WinIOError(WinError, IOError):
144 class WinIOError(WinError, IOError):
139 def __init__(self, err, filename=None):
145 def __init__(self, err, filename=None):
General Comments 0
You need to be logged in to leave comments. Login now