Can not catch Error: connect ECONNREFUSED 0.0.0.0:5000


#1

Hi

I am develobing node js tool to get data from octoprint API

And I want to cover if my tool running but octoprint not running
When I try to run my tool when octoprint turned off
I face this error

events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: connect ECONNREFUSED 0.0.0.0:5000
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1191:14)

I try to catch it but I fail

Can someone help me with this
How I can catch it so I can run octoprint then try to connect

Thank you


#2

I suggest you ask that in a NodeJS forum, it's a bit off topic here.


#3

Take a look at my octo-client Node module. I doubt that I covered every possibility but it's certainly NodeJS-based.


#4

@OutsourcedGuru
I really like your octo-client and I am working on it
also I add some functionality to it so it can help in my tool

Thank you

About my issue

I solve it by adding this to my code

process.on('uncaughtException',function(err){
// handle
});