http client class

This commit is contained in:
2021-01-03 15:19:29 -06:00
parent ad082eb0f9
commit 42a8e0c886
5 changed files with 99 additions and 86 deletions

View File

@ -41,7 +41,12 @@ def operation():
types_csv = ", ".join(handlers.keys())
if isinstance(request_body, dict) and 'type' in request_body:
if request_body['type'] in handlers:
return handlers[request_body['type']](request_body)
try:
return handlers[request_body['type']](request_body)
except:
error_message = my_exec_info_message(sys.exc_info())
current_app.logger.error(f"unhandled exception in {request_body['type']} handler: {error_message}")
return jsonify(dict(error_message=error_message))
else:
error_message = f"'type' must be one of {types_csv}"
else: