fix: replace broad except Exception with specific exception types
- jail_service: catch ValueError (fail2ban protocol error) instead of Exception - health.py: catch AttributeError (not OSError/TypeError) for defensive checks - ban_service: re-raise programming errors in geo lookup handlers - server_service: catch Fail2BanConnectionError, Fail2BanProtocolError, ValueError - config_writer: catch OSError instead of Exception Programming errors now bubble to global handler instead of being silently caught. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -150,7 +150,7 @@ def _write_parser_atomic(
|
||||
with os.fdopen(fd, "w", encoding="utf-8") as f:
|
||||
f.write(content)
|
||||
os.replace(tmp_path_str, str(path))
|
||||
except Exception:
|
||||
except OSError:
|
||||
with contextlib.suppress(OSError):
|
||||
os.unlink(tmp_path_str)
|
||||
raise
|
||||
|
||||
Reference in New Issue
Block a user