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,17 +32,19 @@ elif http_method == "POST":
# assume write request
try:
data = context.REQUEST.data
except AttributeError:
except AttributeError as e:
log("Warning: 'data' is missing from request.")
raise e
else:
data = json.loads(data)
if 'node' in data.keys():
# log only set requests for now
node_id = data['node']
node_value = data['val']
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[node_id] = convertNodeValue(node_id, node_value)
default_opcua_document.setNodeDict(node_dict)
log("Changed = %s" %default_opcua_document.getNodeDict())
# 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))
node_dict = default_opcua_document.getNodeDict()
node_dict[node_id] = convertNodeValue(node_id, node_value)
default_opcua_document.setNodeDict(node_dict)
log("Changed = %s" %default_opcua_document.getNodeDict())
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