mirror of
https://github.com/OpenBankProject/API-Manager.git
synced 2026-02-06 15:06:48 +00:00
clean the unuseful error handling
This commit is contained in:
parent
351553729c
commit
3d9b92880c
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user