axios icon indicating copy to clipboard operation
axios copied to clipboard

@nestjs/axios: Expose AxiosError class

Open yoshigev opened this issue 4 months ago • 1 comments

Is there an existing issue that is already proposing this?

  • [x] I have searched the existing issues

Is your feature request related to a problem? Please describe it

The example here shows how to capture an error:

        catchError((error: AxiosError) => {

The problem is that AxiosError is not exported anywhere that is accessible.

Describe the solution you'd like

I think that AxiosError should be importable like:

import { AxiosError } from '@nestjs/axios';

Teachability, documentation, adoption, migration strategy

Currently, I think the only correct way of accessing it, is installing the axios package itself and import it from there.

What is the motivation / use case for changing the behavior?

Avoiding the need to install axios package.

yoshigev avatar Sep 09 '25 09:09 yoshigev

Actually isAxiosError is a better alternative to use, but I would add both if possible.

yoshigev avatar Sep 09 '25 12:09 yoshigev