Coder Social home page Coder Social logo

Comments (3)

OliverJAsh avatar OliverJAsh commented on June 10, 2024 1

Ah, but I think this is still an issue—that node-fetch doesn't return a more informative error message?

from node-fetch.

OliverJAsh avatar OliverJAsh commented on June 10, 2024

I am facing the same issue. We're using error.message and the "reason" is empty. Reduced test case:

import fetch from 'node-fetch';
fetch('http://localhost:1234/regdvfs');

Result:

file:///Users/oliver/Code/unsplash/unsplash-web/node_modules/node-fetch/src/index.js:108
			reject(new FetchError(`request to ${request.url} failed, reason: ${error.message}`, 'system', error));
			       ^

FetchError: request to http://localhost:1234/regdvfs failed, reason:
    at ClientRequest.<anonymous> (file:///Users/oliver/Code/unsplash/unsplash-web/node_modules/node-fetch/src/index.js:108:11)
    at ClientRequest.emit (node:events:518:28)
    at Socket.socketErrorListener (node:_http_client:500:9)
    at Socket.emit (node:events:518:28)
    at emitErrorNT (node:internal/streams/destroy:169:8)
    at emitErrorCloseNT (node:internal/streams/destroy:128:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  type: 'system',
  errno: 'ECONNREFUSED',
  code: 'ECONNREFUSED',
  erroredSysCall: undefined
}

error.message:

FetchError: request to http://localhost:1234/regdvfs failed, reason:

I'd expect something like this:

FetchError: request to http://localhost:1234/regdvfs failed, reason: ECONNREFUSED

from node-fetch.

sibelius avatar sibelius commented on June 10, 2024

mine was a failing dns service

from node-fetch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.