got: Missing code property on error

I’m getting no code property on the error.

RequestError: connect ECONNREFUSED 127.0.0.1:123,
  at ClientRequest.<anonymous> (/proj/node_modules/got/dist/source/core/index.js:953:111),
  at Object.onceWrapper (events.js:520:26),
  at ClientRequest.emit (events.js:412:35),
  at ClientRequest.origin.emit (/proj/node_modules/@szmarczak/http-timer/dist/source/index.js:39:20),
  at onerror (/proj/node_modules/agent-base/dist/src/index.js:117:21),
  at callbackError (/proj/node_modules/agent-base/dist/src/index.js:136:17),
  at processTicksAndRejections (internal/process/task_queues.js:95:5),
  at SocksClient.closeSocket (/proj/node_modules/socks/build/client/socksclient.js:387:32),
  at SocksClient.onErrorHandler (/proj/node_modules/socks/build/client/socksclient.js:360:14),
  at Socket.onError (/proj/node_modules/socks/build/client/socksclient.js:222:38),

error.code is undefined but it is a got Error because error instanceof RequestError is true. Could it be because of socksclient.js?

How can I get access to error.code which should be ECONNREFUSED here?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 15

Most upvoted comments

I am facing the same issue, any error that got returns are sent without the code property.