Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/typicode/json-server
Browse files Browse the repository at this point in the history
  • Loading branch information
typicode committed Oct 18, 2018
2 parents 6295994 + 8471699 commit 675a3cb
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/cli/run.js
Expand Up @@ -132,6 +132,20 @@ module.exports = function(argv) {

// Display server informations
prettyPrint(argv, db.getState(), routes)

// Catch and handle any error occurring in the server process
process.on('uncaughtException', error => {
if (error.errno === 'EADDRINUSE')
console.log(
chalk.red(
`Cannot bind to the port ${
error.port
}. Specify some other port number either through --port argument or through the json-server.json configuration file`
)
)
else console.log('Some error occurred', error)
process.exit(1)
})
})
}

Expand Down

0 comments on commit 675a3cb

Please sign in to comment.