add try except blocks and http internal error web response
@@ -384,14 +384,13 @@ class Server:
@classmethod
def start(cls):
"""Starts FogLAMP"""
-
loop = asyncio.get_event_loop()
cls._start_core(loop=loop)
@classmethod
async def _stop(cls):
"""Stops FogLAMP"""
-
+ try:
# stop the scheduler
await cls._stop_scheduler()
@@ -407,6 +406,8 @@ class Server:
# stop core management api
# loop.stop does it all ?!
# await cls.stop_core_server()
+ except Exception:
+ raise
@classmethod
def stop(cls, loop=None):
@@ -659,6 +660,8 @@ class Server:
loop.stop()
return web.json_response({'message': 'FogLAMP stopped successfully.'})
+ except TimeoutError as err:
+ raise web.HTTPInternalServerError(reason=str(err))
except Exception as ex:
raise web.HTTPException(reason=str(ex))
