mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-13 06:34:25 -04:00
handle BaseExceptions properly
This commit is contained in:
parent
87970a254f
commit
2e57df917e
2 changed files with 7 additions and 2 deletions
|
@ -502,11 +502,13 @@ def write_config_file(config: Dict[str, str], out_dir: str=None) -> ConfigDict:
|
||||||
key.upper(): CONFIG.get(key.upper())
|
key.upper(): CONFIG.get(key.upper())
|
||||||
for key in config.keys()
|
for key in config.keys()
|
||||||
}
|
}
|
||||||
except BaseException:
|
except BaseException: # lgtm [py/catch-base-exception]
|
||||||
# something went horribly wrong, rever to the previous version
|
# something went horribly wrong, rever to the previous version
|
||||||
with open(f'{config_path}.bak', 'r', encoding='utf-8') as old:
|
with open(f'{config_path}.bak', 'r', encoding='utf-8') as old:
|
||||||
atomic_write(config_path, old.read())
|
atomic_write(config_path, old.read())
|
||||||
|
|
||||||
|
raise
|
||||||
|
|
||||||
if Path(f'{config_path}.bak').exists():
|
if Path(f'{config_path}.bak').exists():
|
||||||
os.remove(f'{config_path}.bak')
|
os.remove(f'{config_path}.bak')
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,10 @@ class TimedProgress:
|
||||||
# kill the progress bar subprocess
|
# kill the progress bar subprocess
|
||||||
try:
|
try:
|
||||||
self.p.close() # must be closed *before* its terminnated
|
self.p.close() # must be closed *before* its terminnated
|
||||||
except BaseException:
|
except (KeyboardInterrupt, SystemExit):
|
||||||
|
print()
|
||||||
|
raise
|
||||||
|
except BaseException: # lgtm [py/catch-base-exception]
|
||||||
pass
|
pass
|
||||||
self.p.terminate()
|
self.p.terminate()
|
||||||
self.p.join()
|
self.p.join()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue