Skip to content

Commit

Permalink
server: fix crash when any webserver dependency is not installed (#877)
Browse files Browse the repository at this point in the history
Before, when a user enables webserver and does not install sanic, the app just crashes.
Now, log an error log.
  • Loading branch information
cosven authored Nov 6, 2024
1 parent 9c54556 commit 63934aa
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions feeluown/app/server_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ def run(self):
self.config.PUBSUB_PORT,
))
if self.config.ENABLE_WEB_SERVER:
from feeluown.webserver import run_web_server
asyncio.create_task(
run_web_server(self.get_listen_addr(), self.config.WEB_PORT))
try:
from feeluown.webserver import run_web_server
except ImportError as e:
logger.error(f"can't enable webserver, err: {e}")
else:
asyncio.create_task(
run_web_server(self.get_listen_addr(), self.config.WEB_PORT))
asyncio.create_task(run_nowplaying_server(self))

0 comments on commit 63934aa

Please sign in to comment.