Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack trace back to client code #2293

Open
2 tasks done
dandv opened this issue Aug 28, 2023 · 0 comments
Open
2 tasks done

Stack trace back to client code #2293

dandv opened this issue Aug 28, 2023 · 0 comments

Comments

@dandv
Copy link

dandv commented Aug 28, 2023

What problem are you trying to solve?

When a got request throws, I would like to see a stack trace back to the line in my code that generates the error.

I'm using got v13.0.0 with the node16 settings in tsconfig.json.

Describe the feature

import got from 'got';

const response = await got('http://127.0.0.1:3000').text();

console.log(response);

The output doesn't point to any line in my code:


file:///home/dandv/node_modules/got/dist/source/core/index.js:792
            error = error instanceof TimedOutTimeoutError ? new TimeoutError(error, this.timings, this) : new RequestError(error.message, error, this);
                                                                                                          ^
RequestError: connect ECONNREFUSED 127.0.0.1:3000
    at ClientRequest.<anonymous> (file:///home/dandv/node_modules/got/dist/source/core/index.js:792:107)
    at Object.onceWrapper (node:events:629:26)
    at ClientRequest.emit (node:events:526:35)
    at ClientRequest.emit (node:domain:489:12)
    at Socket.socketErrorListener (node:_http_client:501:9)
    at Socket.emit (node:events:514:28)
    at Socket.emit (node:domain:489:12)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16) {
  input: undefined,
  code: 'ECONNREFUSED',
  timings: {
    start: 1693228883449,
    // ...
    }
  },
  options: Options {
    _unixOptions: undefined,
    _internals: {
      // ...
    },
    _merging: false,
    _init: []
  }
}

Checklist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant