2
1
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2023-12-13 21:00:40 +01:00

Handle EADDRINUSE

no ref
- Show a human readable message on EADDRINUSE
This commit is contained in:
Fabian Becker 2014-09-09 14:20:31 +00:00
parent 9c0b203dce
commit 5430e72753

View file

@ -123,6 +123,17 @@ GhostServer.prototype.start = function (externalApp) {
);
}
self.httpServer.on('error', function (error) {
if (error.errno === 'EADDRINUSE') {
console.log('ERROR: Cannot start Ghost. Another program is already using this port (is another Ghost instance already running?)'.red);
} else {
console.log(
'ERROR: There was an error starting your server. '.red,
('(Code: ' + error.errno + ')').red
);
}
process.exit(-1);
});
self.httpServer.on('connection', self.connection.bind(self));
self.httpServer.on('listening', function () {
self.logStartMessages();