clean the unuseful error handling

This commit is contained in:
hongwei1 2019-09-17 14:31:34 +02:00
parent 351553729c
commit 3d9b92880c

View File

@ -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