From 3d9b92880c67c6d8b541cc9ae5702dcde62f8d8b Mon Sep 17 00:00:00 2001 From: hongwei1 Date: Tue, 17 Sep 2019 14:31:34 +0200 Subject: [PATCH] clean the unuseful error handling --- apimanager/methodrouting/views.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/apimanager/methodrouting/views.py b/apimanager/methodrouting/views.py index 0064051..9832be7 100644 --- a/apimanager/methodrouting/views.py +++ b/apimanager/methodrouting/views.py @@ -64,18 +64,14 @@ def methodrouting_save(request): } api = API(request.session.get('obp')) - try: - if(""==method_routing_id): # if method_routing_id=="". we will create a new method routing . - urlpath = '/management/method_routings' - result = api.post(urlpath, payload=payload) - else: # if method_routing_id not empty. we will update the current method routing .. - urlpath = '/management/method_routings/{}'.format(method_routing_id) - result = api.put(urlpath, payload=payload) - except APIError as err: - exception_handle(Exception("OBP-API server is not running or do not response properly. " - "Please check OBP-API server. Details: " + str(err))) - if 'code' in result and result['code'] >= 400: - exception_handle(Exception(result['message'])) + if(""==method_routing_id): # if method_routing_id=="". we will create a new method routing . + urlpath = '/management/method_routings' + result = api.post(urlpath, payload=payload) + else: # if method_routing_id not empty. we will update the current method routing .. + urlpath = '/management/method_routings/{}'.format(method_routing_id) + result = api.put(urlpath, payload=payload) + + return result @exception_handle