summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLV-426 <lv-426@taproot.org.il>2014-11-09 12:18:05 +0200
committerLV-426 <lv-426@taproot.org.il>2014-11-09 12:18:05 +0200
commit8e6eeb0db8616b79211f0c03472074bc36885658 (patch)
tree1e93730ca46f5fe09499180152aa8506f350f9e3
parentd5dd1d471b0c16caf395e32996cb7caa25fce326 (diff)
common request handling
-rw-r--r--src-py/rhizi_api.py17
1 files changed, 5 insertions, 12 deletions
diff --git a/src-py/rhizi_api.py b/src-py/rhizi_api.py
index 7a6a44e9..53edf8f5 100644
--- a/src-py/rhizi_api.py
+++ b/src-py/rhizi_api.py
@@ -59,7 +59,9 @@ def __common_exec(op, on_success=__common_resp_handle):
op_ret = db_ctl.exec_op(op)
return on_success(op_ret)
except Exception as e:
- return __common_resp_handle('exception raised: add_node_set')
+ log.error(e.message)
+ log.error(traceback.print_exc())
+ return __common_resp_handle('error occurred')
@webapp.route("/load/node-set-by-id", methods=['POST'])
def load_node_set_by_id_attr():
@@ -110,12 +112,7 @@ def load_link_set_by_link_ptr_set():
l_ptr_set = deserialize_param_set(request.get_json())
op = dbc.DBO_load_link_set.init_from_link_ptr_set(l_ptr_set)
- try:
- l_set = db_ctl.exec_op(op)
- return __common_resp_handle(data=l_set)
- except Exception as e:
- log.exception(e)
- return __common_resp_handle(error='unable to load link set')
+ return __common_exec(op)
@webapp.route("/graph/topo-diff-commit", methods=['POST'])
def topo_diff_commit():
@@ -150,9 +147,5 @@ def add_node_set():
__sanitize_input(node_map)
op = dbc.DBO_add_node_set(node_map)
- try:
- n_set = db_ctl.exec_op(op)
- return __common_resp_handle(n_set)
- except Exception as e:
- return __common_resp_handle('exception raised: add_node_set')
+ return __common_exec(op)