better error message

This commit is contained in:
Emmanuel Garette 2019-12-28 12:29:52 +01:00
parent baff78069c
commit 3c527da97b
2 changed files with 4 additions and 9 deletions

View File

@ -44,10 +44,7 @@ class Common:
verify=False)
code = req.status_code
if code != 200:
err = self.get_error_from_http(req)
raise Exception('unable to load url ({}): {} ({})'.format(url,
err,
code))
raise Exception(self.get_error_from_http(req))
json = req.json()
return config_type(json)

View File

@ -17,11 +17,8 @@ class ConfigAPI(Config):
if isinstance(payload['value'], list):
payload['value_multi'] = payload['value']
del payload['value']
ret = send_data(self.message,
send_data(self.message,
payload)
if ret['status'] == 'error':
msg = _("cannot modify variable {} : {}").format(payload['name'],ret['message'])
raise Exception(msg)
self.updates = []
@ -57,6 +54,7 @@ class Configuration(Common):
try:
index = parameters.index('--sessionid')
except ValueError:
# FIXME not working ...
tiramisu_config = self.remote_json_to_config(ConfigAPI)
parser = TiramisuCmdlineParser(tiramisu_config,
self.prog,