diff options
| author | LV-426 <lv-426@taproot.org.il> | 2015-04-09 01:30:13 +0300 |
|---|---|---|
| committer | LV-426 <lv-426@taproot.org.il> | 2015-04-09 02:03:45 +0300 |
| commit | dd01a7938b8cdc0f85216a28f3f5f22fc7506113 (patch) | |
| tree | 5b93bd82b7dfa99fe28d5aa2c81597109cfb67f2 /src/server/rz_api_rest.py | |
| parent | c6d45c3ed12bc4bddd29b840199d9f24b0ce873e (diff) | |
rz_api_rest: handle RZDoc_Exception__already_exists
Diffstat (limited to 'src/server/rz_api_rest.py')
| -rw-r--r-- | src/server/rz_api_rest.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/server/rz_api_rest.py b/src/server/rz_api_rest.py index f12a6d91..b75ea26b 100644 --- a/src/server/rz_api_rest.py +++ b/src/server/rz_api_rest.py @@ -10,22 +10,22 @@ from flask import current_app import flask import logging -import traceback from model.graph import Attr_Diff from model.graph import Topo_Diff -from rz_api_common import sanitize_input__attr_diff, cache_lookup__rzdoc, \ +from rz_api_common import sanitize_input__attr_diff, \ __sanitize_input, sanitize_input__rzdoc_name from rz_api_common import sanitize_input__topo_diff from rz_api_common import validate_obj__attr_diff from rz_req_handling import common_resp_handle__success, make_response__json, \ HTTP_STATUS__204_NO_CONTENT, HTTP_STATUS__201_CREATED, \ - common_resp_handle__client_error, common_resp_handle__server_error, \ - common_rest_req_exception_handler + common_resp_handle__client_error, \ + common_rest_req_exception_handler, common_resp_handle__server_error from db_op import DBO_match_node_set_by_id_attribute, \ DBO_load_link_set, DBO_match_node_id_set, DBO_diff_commit__topo from model.model import Link from rz_api import rz_mainpage +from rz_kernel import RZDoc_Exception__already_exists log = logging.getLogger('rhizi') @@ -213,7 +213,10 @@ def rzdoc__create(rzdoc_name): s_rzdoc_name = sanitize_input__rzdoc_name(rzdoc_name) kernel = flask.current_app.kernel ctx = __context__common(rzdoc_name=None) # avoid rzdoc cache lookup exception - kernel.rzdoc__create(s_rzdoc_name, ctx) + try: + kernel.rzdoc__create(s_rzdoc_name, ctx) + except RZDoc_Exception__already_exists as e: + return common_resp_handle__server_error(error='rzdoc already exists') return make_response__json(status=HTTP_STATUS__201_CREATED) @common_rest_req_exception_handler |
