Skip to content

Commit

Permalink
__init__.py: Add server.listen error message
Browse files Browse the repository at this point in the history
If the protocol is not specified/wrong the error message is quite cryptic
  • Loading branch information
sjrct committed Jan 15, 2024
1 parent d01d881 commit c7de10c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion isso/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,14 @@ def main():
except ImportError:
run_simple(host, port, make_app(conf), threaded=True,
use_reloader=conf.getboolean('server', 'reload'))
else:
elif conf.get("server", "listen").startswith("unix://"):
sock = conf.get("server", "listen").partition("unix://")[2]
try:
os.unlink(sock)
except OSError as ex:
if ex.errno != errno.ENOENT:
raise
wsgi.SocketHTTPServer(sock, make_app(conf)).serve_forever()
else:
logger.error("server.listen must specif a protocol of http:// or unix://")
sys.exit(1)

0 comments on commit c7de10c

Please sign in to comment.