explicite error when value in param is invalid

This commit is contained in:
Emmanuel Garette 2020-08-19 11:20:46 +02:00
parent 10637656fa
commit e787eb2ef5
2 changed files with 4 additions and 4 deletions

View File

@ -42,7 +42,7 @@ class CallDispatcher:
raise Exception('hu?')
else:
for ret in returns:
async with await Config(response, display_name=lambda self, dyn_name: self.impl_getname()) as config:
async with await Config(response) as config:
await config.property.read_write()
try:
for key, value in ret.items():
@ -238,11 +238,11 @@ class Dispatcher(register.RegisterDispatcher,
except AttributeError:
if get_config()['global']['debug']:
print_exc()
raise ValueError(_(f'unknown parameter in "{uri}": "{key}"'))
raise ValueError(_(f'"{uri}" is launch with an unknown: "{key}"'))
except ValueError as err:
if get_config()['global']['debug']:
print_exc()
raise ValueError(_(f'invalid value for "{key}" in "{uri}": {err}'))
raise ValueError(_(f'"{uri}" is launch with and invalid value for "{key}": {err}'))
# check mandatories options
if check_role and get_config().get('global').get('check_role'):
await self.check_role(subconfig,

View File

@ -108,7 +108,7 @@ class RegisterDispatcher:
async def get_message_args(self,
message: str):
# load config
async with await Config(self.option) as config:
async with await Config(self.option, display_name=lambda self, dyn_name, suffix: self.impl_getname()) as config:
await config.property.read_write()
# set message to the message name
await config.option('message').value.set(message)