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": ...@@ -32,17 +32,19 @@ 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']
log("Set '%s' = '%s' to %s as %s" %(node_id, node_value, default_opcua_document, node_id)) # set to "ERP5 OPCUA Document" but only if it's not a None value
# set to "ERP5 OPCUA Document" if node_value is not None and node_value != "None":
node_dict = default_opcua_document.getNodeDict() log("Set '%s' = '%s' to %s as %s" %(node_id, node_value, default_opcua_document, node_id))
node_dict[node_id] = convertNodeValue(node_id, node_value) node_dict = default_opcua_document.getNodeDict()
default_opcua_document.setNodeDict(node_dict) node_dict[node_id] = convertNodeValue(node_id, node_value)
log("Changed = %s" %default_opcua_document.getNodeDict()) 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