Skip to content

Commit

Permalink
Handle EADDRINUSE error code
Browse files Browse the repository at this point in the history
  • Loading branch information
iiegor committed Apr 30, 2016
1 parent beba614 commit 090b68f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/server.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,11 @@ class Server
@logger.log @logger.level.ERROR, "Unhandled message #{String.fromCharCode(firstByte)}", null

handleError: (e) ->
@logger.log @logger.level.ERROR, e.message, e
switch e.code
when 'EADDRINUSE'
@logger.log @logger.level.ERROR, 'The address is already in use, change the port number', e
else
@logger.log @logger.level.ERROR, e.message, e

generateFood: (amount) ->
i = 0
Expand Down

0 comments on commit 090b68f

Please sign in to comment.