expand units: Log missed bytes unit expansions

This commit is contained in:
deajan 2024-04-23 12:44:39 +02:00
parent 476fc636dd
commit bd8e7e1925

View file

@ -402,6 +402,7 @@ def expand_units(object_config: dict, unexpand: bool = False) -> dict:
"upload_speed", "upload_speed",
"download_speed", "download_speed",
): ):
try:
if value: if value:
if unexpand: if unexpand:
return BytesConverter(value).human_iec_bytes return BytesConverter(value).human_iec_bytes
@ -410,6 +411,8 @@ def expand_units(object_config: dict, unexpand: bool = False) -> dict:
if unexpand: if unexpand:
return BytesConverter(0).human_iec_bytes return BytesConverter(0).human_iec_bytes
return BytesConverter(0) return BytesConverter(0)
except ValueError:
logger.warning(f"Cannot parse bytes value {key}:\"{value}\", keeping as is")
return value return value
return replace_in_iterable(object_config, _expand_units, callable_wants_key=True) return replace_in_iterable(object_config, _expand_units, callable_wants_key=True)