mirror of
https://github.com/tenrok/axios.git
synced 2026-06-20 20:00:40 +03:00
Adding console log on sandbox server startup (#2210)
* Adding console log on sandbox server startup * Update server.js Add server error handeling * Update server.js Better error message, remove retry. Co-authored-by: Philippe Recto <precto1285@gmal.com> Co-authored-by: Felipe Martins <felipewmartins@gmail.com> Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
+11
-3
@@ -54,8 +54,8 @@ server = http.createServer(function (req, res) {
|
|||||||
console.error('Error:', e.message);
|
console.error('Error:', e.message);
|
||||||
status = 400;
|
status = 400;
|
||||||
result = {
|
result = {
|
||||||
error: e.message
|
error: e.message
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
res.writeHead(status, {
|
res.writeHead(status, {
|
||||||
@@ -69,4 +69,12 @@ server = http.createServer(function (req, res) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
server.listen(3000);
|
const PORT = 3000;
|
||||||
|
|
||||||
|
server.listen(PORT, console.log(`Listening on localhost:${PORT}...`));
|
||||||
|
server.on('error', (error) => {
|
||||||
|
if (error.code === 'EADDRINUSE') {
|
||||||
|
console.log(`Address localhost:${PORT} in use please retry when the port is available!`);
|
||||||
|
server.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user