Skip to content

Commit d8412bf

Browse files
committed
Add listen() error handling
Express 5 moves this responsibility to us
1 parent dbc675f commit d8412bf

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ const config = require('./config');
66
const metrics = require('./metrics');
77

88
const port = config.APP.port;
9-
app.listen(port, function() {
9+
app.listen(port, (err) => {
10+
if (err) {
11+
throw err;
12+
}
13+
1014
// Update permissions of unix sockets
1115
if (typeof port === 'string' && port.startsWith('/') && config.APP.unixSocketPermissions >= 0) {
1216
fs.chmod(port, config.APP.unixSocketPermissions, function(err) {
@@ -16,6 +20,7 @@ app.listen(port, function() {
1620
}
1721
});
1822
}
23+
1924
logger.info('Started on port: %s', port);
2025
});
2126

0 commit comments

Comments
 (0)