Narrow bare except to specific exception types in convert_mactime_to_datetime

This commit is contained in:
Janik Besendorf
2026-03-25 08:44:00 +01:00
parent 4495a46688
commit 869f3a110c

View File

@@ -119,10 +119,9 @@ def convert_mactime_to_datetime(timestamp: Union[int, float], from_2001: bool =
if from_2001:
timestamp = timestamp + 978307200
# TODO: This is rather ugly. Happens sometimes with invalid timestamps.
try:
return convert_unix_to_utc_datetime(timestamp)
except Exception:
except (OSError, OverflowError, ValueError):
return None