Minor app fixes and improvements.
This commit is contained in:
@@ -148,17 +148,23 @@ export default class LocalServer {
|
||||
|
||||
public start(): void {
|
||||
try {
|
||||
this.server = this.app.listen(this.PORT, (error: Error | undefined) => {
|
||||
if (error) {
|
||||
this.server = http.createServer(this.app);
|
||||
|
||||
this.server.on("error", (error: NodeJS.ErrnoException) => {
|
||||
if (error.code === "EADDRINUSE") {
|
||||
log.error(
|
||||
`[HTTP Server] Error starting server: ${errorTypeCheck(error)}`,
|
||||
`[HTTP Server] Port ${this.PORT} is already in use. Please use a different port.`,
|
||||
);
|
||||
} else {
|
||||
log.info(
|
||||
`[HTTP Server] Local HTTP server running on port ${this.PORT}`,
|
||||
);
|
||||
log.error(`[HTTP Server] Server error: ${error.message}`);
|
||||
}
|
||||
});
|
||||
|
||||
this.server.listen(this.PORT, () => {
|
||||
log.info(
|
||||
`[HTTP Server] Local HTTP server running on port ${this.PORT}`,
|
||||
);
|
||||
});
|
||||
} catch (error: unknown) {
|
||||
log.error("[HTTP Server] Error starting server", errorTypeCheck(error));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user