Browse Source

Capture module load exception

Change-Id: I1f04351160fcdb0008a25f5898bfc6cc29a58055
changes/94/483294/1
Lingxian Kong 4 years ago
parent
commit
f870ac6871
  1. 11
      runtimes/python2/server.py

11
runtimes/python2/server.py

@ -86,8 +86,15 @@ def execute():
context = {'os_session': openstack_session}
importer = zipimport.zipimporter(zip_file)
module = importer.load_module(function_module)
try:
importer = zipimport.zipimporter(zip_file)
module = importer.load_module(function_module)
except Exception as e:
return Response(
response=json.dumps({'output': str(e), 'duration': 0}),
status=200,
mimetype='application/json'
)
input = {}
if request.form:

Loading…
Cancel
Save