Skip to content

Commit

Permalink
Fix server.listen error handling (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dima Paloskin authored and leo committed Apr 12, 2017
1 parent 6a25bf6 commit 2a1b741
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions index.js
@@ -1,9 +1,7 @@
module.exports = srv => new Promise((resolve, reject) => {
srv.listen(err => {
if (err) {
return reject(err)
}
srv.on('error', reject)

srv.listen(() => {
const {port} = srv.address()
resolve(`http://localhost:${port}`)
})
Expand Down

0 comments on commit 2a1b741

Please sign in to comment.