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

interceptors.responseError does not raise networking errors #3929

Closed
Gigioliva opened this issue Dec 7, 2024 · 2 comments
Closed

interceptors.responseError does not raise networking errors #3929

Gigioliva opened this issue Dec 7, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@Gigioliva
Copy link
Contributor

interceptors.responseError does not raise networking errors

When the interceptors.responseError interceptor is used, this does not raise network errors, returning the request as if it had been successful.

Reproducible By

import { Pool } from "undici";

const URL = "https://foo.bar.ciao.com"; // <- URL does not exist

async function main() {
  const client = new Pool(URL);

  try {
    const response = await client
      .compose(interceptors.responseError({ throwOnError: true }))
      .request({ method: "GET", path: "/" });

    console.log(response.statusCode);
  } catch (e) { // <- not raised
    console.log(e);
  }
}

if (require.main === module) {
  void main();
}

Expected Behavior

request raises an error Error: getaddrinfo ENOTFOUND. This is raised when we don't use interceptors.responseError

Environment

  • node: 20.18
  • undici: 7.1.0
@Gigioliva Gigioliva added the bug Something isn't working label Dec 7, 2024
@Gigioliva
Copy link
Contributor Author

I think the problem is here. The error is the second parameter (not included)

@Gigioliva
Copy link
Contributor Author

#3930

@tsctx tsctx closed this as completed Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants