Handle fetch errors
SagnikPradhan opened this issue · comments
Sagnik Pradhan commented
Describe the feature
Rather than throwing the fetch error and causing an unhandled exception, it should handle the error and return an error response.
TypeError: fetch failed
at Object.fetch (node:internal/deps/undici/undici:11457:11)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at runNextTicks (node:internal/process/task_queues:64:3)
at process.processImmediate (node:internal/timers:449:9)
at async Object.http (/home/.../packages/server/node_modules/ipx/dist/index.cjs:141:22)
at async _handleRequest (/home/.../packages/server/node_modules/ipx/dist/index.cjs:567:18) {
cause: ConnectTimeoutError: Connect Timeout Error
at onConnectTimeout (/home/.../packages/server/node_modules/next/dist/compiled/undici/index.js:1:82152)
at /home/.../packages/server/node_modules/next/dist/compiled/undici/index.js:1:81644
at Immediate._onImmediate (/home/.../packages/server/node_modules/next/dist/compiled/undici/index.js:1:82034)
at process.processImmediate (node:internal/timers:478:21) {
code: 'UND_ERR_CONNECT_TIMEOUT'
}
}
Additional information
- Would you be willing to help implement this feature?
Pooya Parsa commented
Hi. Fetch errors should be slighly better in next major version (v2) with location details.