Cleanup.
This commit is contained in:
parent
abdb5cb531
commit
ab19d7b5dd
|
@ -112,16 +112,17 @@ def configure_socket(
|
||||||
server_settings["port"],
|
server_settings["port"],
|
||||||
backlog=backlog,
|
backlog=backlog,
|
||||||
)
|
)
|
||||||
except PermissionError as e:
|
except PermissionError:
|
||||||
p = server_settings["port"]
|
p = server_settings["port"]
|
||||||
if p and server_settings["port"] < 1024:
|
if not p or p >= 1024:
|
||||||
addr = f"{server_settings['host']}:{p}"
|
raise
|
||||||
e = ServerError(
|
addr = f"{server_settings['host']}:{p}"
|
||||||
f"Permission denied binding to {addr}.\n\n"
|
error = ServerError(
|
||||||
"Use `sudo sanic` to run on a privileged port.\n"
|
f"Permission denied binding to {addr}.\n\n"
|
||||||
)
|
"Use `sudo sanic` to run on a privileged port.\n"
|
||||||
e.quiet = True
|
)
|
||||||
raise e from None
|
error.quiet = True
|
||||||
|
raise error
|
||||||
except OSError as e: # no cov
|
except OSError as e: # no cov
|
||||||
error = ServerError(
|
error = ServerError(
|
||||||
f"Sanic server could not start: {e}.\n\n"
|
f"Sanic server could not start: {e}.\n\n"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user