Merge pull request #79 from jterrace/raise-fixes
Fix re-raising exceptions in locked file to preserve stack trace.
This commit is contained in:
@@ -210,9 +210,9 @@ try:
|
|||||||
except IOError as e:
|
except IOError as e:
|
||||||
# If not retrying, then just pass on the error.
|
# If not retrying, then just pass on the error.
|
||||||
if timeout == 0:
|
if timeout == 0:
|
||||||
raise e
|
raise
|
||||||
if e.errno != errno.EACCES:
|
if e.errno != errno.EACCES:
|
||||||
raise e
|
raise
|
||||||
# We could not acquire the lock. Try again.
|
# We could not acquire the lock. Try again.
|
||||||
if (time.time() - start_time) >= timeout:
|
if (time.time() - start_time) >= timeout:
|
||||||
logger.warn('Could not lock %s in %s seconds',
|
logger.warn('Could not lock %s in %s seconds',
|
||||||
@@ -289,7 +289,7 @@ try:
|
|||||||
return
|
return
|
||||||
except pywintypes.error as e:
|
except pywintypes.error as e:
|
||||||
if timeout == 0:
|
if timeout == 0:
|
||||||
raise e
|
raise
|
||||||
|
|
||||||
# If the error is not that the file is already in use, raise.
|
# If the error is not that the file is already in use, raise.
|
||||||
if e[0] != _Win32Opener.FILE_IN_USE_ERROR:
|
if e[0] != _Win32Opener.FILE_IN_USE_ERROR:
|
||||||
|
|||||||
Reference in New Issue
Block a user