axios icon indicating copy to clipboard operation
axios copied to clipboard

Include `axios.isAxiosError` in axios-http.com docs

Open artze opened this issue 3 years ago • 1 comments

Section/Content To Improve

https://axios-http.com/docs/notes (See "Typescript")

Suggested Improvement

axios.isAxiosError helper is useful in a Typescript environment when handling axios errors. This is documented here: https://github.com/axios/axios#typescript but not mentioned on axios-http.com.

Suggestion: Include the following in axios-http.com docs

let user: User = null;
try {
  const { data } = await axios.get('/user?ID=12345');
  user = data.userDetails;
} catch (error) {
  if (axios.isAxiosError(error)) {
    handleAxiosError(error);
  } else {
    handleUnexpectedError(error);
  }
}

Relevant File(s)

Not sure which files are used for axios-http.com.

I'll be happy to make a PR for this change if agreeable.

artze avatar Jun 04 '22 09:06 artze

I think the documentation is generated from below repository https://github.com/axios/axios-docs

adityasharma7 avatar Aug 22 '22 10:08 adityasharma7

Looks like the docs is already updated.

artze avatar Jun 06 '23 11:06 artze

i cant found the axios.isAxiosError in this doc: https://axios-http.com/ where can i found?

@artze

RobertDS07 avatar Apr 04 '24 17:04 RobertDS07

@RobertDS07

Seems to have disappeared. You can use this as reference though: https://github.com/axios/axios/pull/3767/files

artze avatar Apr 05 '24 02:04 artze