Catch error in file remove process
Catch an error in the file removing process after a database dump for windows users (issue #40)
This commit is contained in:
parent
f09602d5d3
commit
6e61a74250
@ -73,12 +73,20 @@ class DatabaseDumper:
|
||||
|
||||
# If an exception occurs, for example triggered by a timeout, save a message in the log.
|
||||
except Exception as error:
|
||||
logging.error("An error occurred during the dumping process: {}".format(error))
|
||||
logging.error("An error occurred during the dumping process: {}".format(error), exc_info=True)
|
||||
|
||||
# Use a finally block for a short clean up.
|
||||
finally:
|
||||
# Try to remove the file. Use a try statement, because this block can cause errors for windows user.
|
||||
try:
|
||||
# Remove the file, which was used for submitting the password and is no longer necessary.
|
||||
os.remove(file_path)
|
||||
|
||||
# Add the exception to the log.
|
||||
except Exception as error:
|
||||
logging.error("An error occurred during the clean up process of the database dump: {}".format(
|
||||
error), exc_info=True)
|
||||
|
||||
# Return the result.
|
||||
return result
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user