Display "NaN" if size of borg repository is out of bounds (#433)

This commit is contained in:
TheReal1604 2020-04-07 05:16:23 +02:00 committed by GitHub
parent 0c953a98d4
commit 787c36273e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -102,7 +102,12 @@ def pretty_bytes(size):
while size >= power:
size /= power
n += 1
return f'{round(size, 1)} {Dic_powerN[n]}B'
try:
unit = Dic_powerN[n]
return f'{round(size, 1)} {unit}B'
except KeyError as e:
logger.error(e)
return "NaN"
def get_asset(path):