Improve exception handling in HostBlocker
In on_config_changed, we now ignore FileNotFoundError as that's a common occurence and not something worth logging. In case of other OSError's we now also log the exact error message.
This commit is contained in:
parent
f6544786c1
commit
b6add69705
@ -276,8 +276,10 @@ class HostBlocker:
|
|||||||
if urls is None:
|
if urls is None:
|
||||||
try:
|
try:
|
||||||
os.remove(self._local_hosts_file)
|
os.remove(self._local_hosts_file)
|
||||||
except OSError:
|
except FileNotFoundError:
|
||||||
log.misc.exception("Failed to delete hosts file.")
|
pass
|
||||||
|
except OSError as e:
|
||||||
|
log.misc.exception("Failed to delete hosts file: {}".format(e))
|
||||||
|
|
||||||
def on_download_finished(self, download):
|
def on_download_finished(self, download):
|
||||||
"""Check if all downloads are finished and if so, trigger reading.
|
"""Check if all downloads are finished and if so, trigger reading.
|
||||||
|
Loading…
Reference in New Issue
Block a user