Jump to content
McKay Development

Question about error handling

What Comes Around

Recommended Posts

Good day!

For a long time, I had few issues with proxy providers, but as of recent, my proxy provider has been providing unreliable proxies. Because of this I have created my own proxy management system and want to flag proxies that they don't catch acting erroneously. So I want to handle proxy connection errors. One error I am having a lot of issue handling is one that looks like this:

Error: connect ETIMEDOUT [ip address and port]
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1159:16) {
  errno: -110,
  code: 'ETIMEDOUT',
  syscall: 'connect',
  address: '[ip address]',
  port: [port]

What I want to do is add some code into "net.js:1159" to handle the error by sending a message to the proxy management system to flag the proxy, after which the proxy is blacklisted. However, I cannot find 'net.js'. Do you have any ideas or suggestions on how I can handle this error?

Edited by What Comes Around
Link to comment
Share on other sites

35 minutes ago, Dr. McKay said:

net.js is part of Node.js itself, so you wouldn't really be able to modify it.

Hmmm, I also get an UnhandledPromiseRejectionWarning for that error. Here is an example:
(node:1755579) UnhandledPromiseRejectionWarning: Error: connect ETIMEDOUT XXXXXXXXXXX(IP address)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1159:16)
(node:1755579) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)

I've looked through both, steam-user and steam-community. Steam user uses netjs to make a socket with CM through a proxy, and Steam community uses the request library to make requests through the proxy. Steam user listens for errors and timeouts from netjs, and Steam community has a callback for http errors that should be thrown if request throws errors. So I really do not understand how the promise rejection isn't handled. My current solution is simple. Firstly, I will reinstall the modules. Maybe I was reading through your code and happened to alter it some way long ago. My bot already checks if it is connected and if for some reason it is not, it will restart itself, requesting a proxy again. In this case, the Proxy Management System can check if a proxy gets dropped too often in a short time frame and blacklist it. This should be a decent workaround but it sucks that I cannot find the root of the problem for now. If you have any idea where the issue could be let me know, and thank you for your help. I'm self taught so... I lack knowledge that might seem basic sometimes and also complex knowledge. Guess you could say, I only know what I wanted to learn :) Thanks again! 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...