Skip to content

Commit

Permalink
fix: reject on server listen error
Browse files Browse the repository at this point in the history
See #84
  • Loading branch information
TimLuq authored and trs committed May 16, 2018
1 parent a794f1e commit ec6d35c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ class FtpServer extends EventEmitter {
.then(hostname => {
this.url.hostname = hostname;
return new Promise((resolve, reject) => {
this.server.once('error', reject);
this.server.listen(this.url.port, err => {
this.server.removeListener('error', reject);
if (err) return reject(err);
this.log.info({
protocol: this.url.protocol.replace(/\W/g, ''),
Expand Down

0 comments on commit ec6d35c

Please sign in to comment.