Just log error on invalid order mode settings

fsp_feeds
Tyler Goodlet 2021-09-16 11:26:11 -04:00
parent 3e25be6321
commit da8bccf788
1 changed files with 22 additions and 15 deletions

View File

@ -208,13 +208,17 @@ class SettingsPane:
size_unit = alloc.size_unit size_unit = alloc.size_unit
# WRITE any settings to current pp's allocator # WRITE any settings to current pp's allocator
try:
if key == 'limit': if key == 'limit':
if size_unit == 'currency': if size_unit == 'currency':
# old = alloc.currency_limit
alloc.currency_limit = float(value) alloc.currency_limit = float(value)
else: else:
# old = alloc.units_limit
alloc.units_limit = float(value) alloc.units_limit = float(value)
elif key == 'slots': elif key == 'slots':
# old = alloc.slots
alloc.slots = int(value) alloc.slots = int(value)
elif key == 'size_unit': elif key == 'size_unit':
@ -225,9 +229,12 @@ class SettingsPane:
elif key != 'account': elif key != 'account':
raise ValueError(f'Unknown setting {key}') raise ValueError(f'Unknown setting {key}')
# READ out settings and update UI
log.info(f'settings change: {key}: {value}') log.info(f'settings change: {key}: {value}')
except ValueError:
log.error(f'Invalid value for `{key}`: {value}')
# READ out settings and update UI
suffix = {'currency': ' $', 'units': ' u'}[size_unit] suffix = {'currency': ' $', 'units': ' u'}[size_unit]
limit = alloc.limit() limit = alloc.limit()