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
.
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: []
}
}
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too