Commit 86a59abf authored by Ivan Tyagov's avatar Ivan Tyagov

Do not swallow exceptions.

At start of opcua-http-gw the code sends None as default values, make sure to filter this (wip).
parent fcfdfa4f
...@@ -32,16 +32,18 @@ elif http_method == "POST": ...@@ -32,16 +32,18 @@ elif http_method == "POST":
# assume write request # assume write request
try: try:
data = context.REQUEST.data data = context.REQUEST.data
except AttributeError: except AttributeError as e:
log("Warning: 'data' is missing from request.") log("Warning: 'data' is missing from request.")
raise e
else: else:
data = json.loads(data) data = json.loads(data)
if 'node' in data.keys(): if 'node' in data.keys():
# log only set requests for now # log only set requests for now
node_id = data['node'] node_id = data['node']
node_value = data['val'] node_value = data['val']
# set to "ERP5 OPCUA Document" but only if it's not a None value
if node_value is not None and node_value != "None":
log("Set '%s' = '%s' to %s as %s" %(node_id, node_value, default_opcua_document, node_id)) log("Set '%s' = '%s' to %s as %s" %(node_id, node_value, default_opcua_document, node_id))
# set to "ERP5 OPCUA Document"
node_dict = default_opcua_document.getNodeDict() node_dict = default_opcua_document.getNodeDict()
node_dict[node_id] = convertNodeValue(node_id, node_value) node_dict[node_id] = convertNodeValue(node_id, node_value)
default_opcua_document.setNodeDict(node_dict) default_opcua_document.setNodeDict(node_dict)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment