error handling when server fails to start

This commit is contained in:
mrigankanand 2021-10-29 03:46:01 +05:30
parent 0d6a907f45
commit 95dfc2d0ce
1 changed files with 23 additions and 20 deletions

View File

@ -21,7 +21,7 @@ from flask import Response
from flask import make_response
from core.alert import write_to_api_console
from core.alert import messages
from core.die import die_success
from core.die import die_success, die_failure
from core.time import now
from api.api_core import structure
from api.api_core import get_value
@ -579,6 +579,7 @@ def start_api_subprocess(options):
"language": options.language,
"options": options
}
try:
if options.api_cert and options.api_cert_key:
app.run(
host=options.api_hostname,
@ -598,6 +599,8 @@ def start_api_subprocess(options):
ssl_context='adhoc',
threaded=True
)
except Exception as e:
die_failure(str(e))
def start_api_server(options):