better error message
This commit is contained in:
parent
baff78069c
commit
3c527da97b
|
@ -44,10 +44,7 @@ class Common:
|
||||||
verify=False)
|
verify=False)
|
||||||
code = req.status_code
|
code = req.status_code
|
||||||
if code != 200:
|
if code != 200:
|
||||||
err = self.get_error_from_http(req)
|
raise Exception(self.get_error_from_http(req))
|
||||||
raise Exception('unable to load url ({}): {} ({})'.format(url,
|
|
||||||
err,
|
|
||||||
code))
|
|
||||||
json = req.json()
|
json = req.json()
|
||||||
return config_type(json)
|
return config_type(json)
|
||||||
|
|
||||||
|
|
|
@ -17,11 +17,8 @@ class ConfigAPI(Config):
|
||||||
if isinstance(payload['value'], list):
|
if isinstance(payload['value'], list):
|
||||||
payload['value_multi'] = payload['value']
|
payload['value_multi'] = payload['value']
|
||||||
del payload['value']
|
del payload['value']
|
||||||
ret = send_data(self.message,
|
send_data(self.message,
|
||||||
payload)
|
payload)
|
||||||
if ret['status'] == 'error':
|
|
||||||
msg = _("cannot modify variable {} : {}").format(payload['name'],ret['message'])
|
|
||||||
raise Exception(msg)
|
|
||||||
|
|
||||||
self.updates = []
|
self.updates = []
|
||||||
|
|
||||||
|
@ -57,6 +54,7 @@ class Configuration(Common):
|
||||||
try:
|
try:
|
||||||
index = parameters.index('--sessionid')
|
index = parameters.index('--sessionid')
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
# FIXME not working ...
|
||||||
tiramisu_config = self.remote_json_to_config(ConfigAPI)
|
tiramisu_config = self.remote_json_to_config(ConfigAPI)
|
||||||
parser = TiramisuCmdlineParser(tiramisu_config,
|
parser = TiramisuCmdlineParser(tiramisu_config,
|
||||||
self.prog,
|
self.prog,
|
||||||
|
|
Loading…
Reference in New Issue