Make server crash when listening to port fails

This commit is contained in:
Zef Hemel
2022-11-25 13:08:59 +01:00
parent aee071be6a
commit 27a8adf347
2 changed files with 6 additions and 2 deletions
+2 -1
View File
@@ -21,6 +21,7 @@ export function serveCommand(options: any, folder: string) {
password: options.password,
});
httpServer.start().catch((e) => {
console.error(e);
console.error("HTTP Server error", e);
Deno.exit(1);
});
}
+4 -1
View File
@@ -289,7 +289,10 @@ export class HttpServer {
this.abortController = new AbortController();
this.app.listen({ port: this.port, signal: this.abortController.signal })
.catch(console.error);
.catch((e: any) => {
console.log("Server listen error:", e.message);
Deno.exit(1);
});
console.log(
`Silver Bullet is now running: http://localhost:${this.port}`,
);