Closed Fedour57 closed 3 years ago
Hello, I'm trying to handle aconnection refused error, if I try to connect to a server that doesn't exist, my app crash.
connection refused
Code:
try { var client = net.createConnection({ port: 49500, host: "255.0.0.0",timeout:1000 }) } catch (error) { console.log(error) }
OR
var client = net.createConnection({ port: 49500, host: "255.0.0.0",timeout:1000 }) .then(val => { console.log("connected") } ).catch(error => { console.log(error) })
The app crash when the client can not connect to the server.
The try catch block should handle the error
@Fedour57, thanks for your feedback! Please, take a look at #53, it might be your problem. You could try some of the workarounds commented over there.
Description
Hello, I'm trying to handle a
connection refused
error, if I try to connect to a server that doesn't exist, my app crash.Steps to reproduce
Code:
OR
Current behavior
The app crash when the client can not connect to the server.
Expected behavior
The try catch block should handle the error
Relevant information