codeoverflow-org / nodecg-io

A NodeCG-bundle which implements Social Media API's in the NodeCG framework
https://nodecg.io
MIT License
108 stars 26 forks source link

RCON Server not being online lets nodecg crash #19

Closed hlxid closed 4 years ago

hlxid commented 4 years ago

Description

When a RCON instance exists and the server can't be reached the RCON service lets NodeCG crash because of an exception even though there is a try catch block in the createClient function of the RCON Service: https://github.com/codeoverflow-org/nodecg-io/blob/413d0dfaa34d9bcbf63c4c91c9ecf3a98c00b7ab/nodecg-io-rcon/extension/index.ts#L55-L71

How to reproduce

  1. Create a RCON Service instance while the corresponding server is running.
  2. Exit NodeCG and (in my case) stop the server.
  3. Run NodeCG and try to login, the error will be logged.

Error Log

UNCAUGHT EXCEPTION! NodeCG will now exit.
{ Error: connect ECONNREFUSED 127.0.0.1:25575
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1083:14)
  errno: 'ECONNREFUSED',
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 25575 }

References

RCON PR: #16

derNiklaas commented 4 years ago

This also occurs when using a websocket-client tries to connect to a server.