liamcottle / rustplus.js

Unofficial NodeJS library for controlling Smart Switches in the PC game Rust
224 stars 46 forks source link

rustplus.js throw error "ETIMEDOUT" when rust server doesn't work because unhandled 'error' event in rustplus.js #29

Closed mqnowa closed 3 years ago

mqnowa commented 3 years ago

rustplus.js throw error "ETIMEDOUT" because unhandled 'error' event in rustplus.js when rust server doesn't work . So program that use rustplus.js will force stop when ETIMEDOUT occur.

mqnowa commented 3 years ago
events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: connect ETIMEDOUT 58.227.90.26:28083
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)
Emitted 'error' event on RustPlus instance at:
    at WebSocket.<anonymous> (C:\Users\***\AppData\Roaming\npm\node_modules\@liamcottle\rustplus.js\rustplus.js:71:22)
    at WebSocket.emit (events.js:315:20)
    at ClientRequest.<anonymous> (C:\Users\***\AppData\Roaming\npm\node_modules\@liamcottle\rustplus.js\node_modules\ws\lib\websocket.js:579:15)
    at ClientRequest.emit (events.js:315:20)
    at Socket.socketErrorListener (_http_client.js:469:9)
    at Socket.emit (events.js:315:20)
    at emitErrorNT (internal/streams/destroy.js:106:8)
    at emitErrorCloseNT (internal/streams/destroy.js:74:3)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  errno: -4039,
  code: 'ETIMEDOUT',
  syscall: 'connect',
  address: '58.227.90.26',
  port: 28083
}
liamcottle commented 3 years ago

Are you catching the error in rustplus.on('error') ?

mqnowa commented 3 years ago

Oh, I could catch the error! Sorry for my noob question and thank you for replying!