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

BREAKING 0.19 API Errors not populating correctly #2225

Closed
larlew opened this issue Jun 12, 2019 · 8 comments
Closed

BREAKING 0.19 API Errors not populating correctly #2225

larlew opened this issue Jun 12, 2019 · 8 comments

Comments

@larlew
Copy link

larlew commented Jun 12, 2019

API Error breaks existing code. The error object is no longer populated.

To Reproduce
catch an error from an api.

Expected behavior
I didn't expect a minor version change to break existing code.

Is there any further guidance or documentation regarding these changes?

Environment:

  • Axios Version [0.19.0]
  • OS: [Windows 10 ]
  • Browser [ Chrome ]
  • Browser Version [75.0.3770.80 (Official Build) (64-bit)]
  • Additional Library Versions [React 16.8.6]

Additional context/Screenshots
const apirequest = (options) => {
return authService.fetchAccessToken()
.then((accessToken) => {
if (!options.headers)
options.headers = {};

  options.headers['Authorization'] = `bearer ${accessToken}`;

  return client(options)
    .then(response => {
      return response.data;
    })
    .catch(error => { console.error(error); });
});

}

@zymawy
Copy link

zymawy commented Jun 12, 2019

Hi @larlew, Having The Same Here

@rafaelrenanpacheco
Copy link
Contributor

On RunKit error is populating just fine:

image

@danielmcq
Copy link

Not trying to be pedantic, but you should never expect a module with a major version "0" to have a stable API. Until the author(s) put it at 1, it's not considered stable. https://semver.org/#spec-item-4

@larlew
Copy link
Author

larlew commented Jun 17, 2019

Fair enough. I did not know that. Thank you.
I do appreciate all the efforts of all the axios contributors. I'm sorry If I came off a bit snarky.
I don't mind adapting my code but I couldn't find any docs on the change.

@danielmcq
Copy link

@larlew No worries. Thank you for submitting detailed bug reports!

The whole major version 0 thing probably gets lots of developers. It’s something I look at closely now whenever my team wants to use a new module in any of our projects. It’s usually not worth the time and effort to use a pre-1.0.0 module in production.

0.19.0 of axios broke a plug-in we use for it. It seems that part of the changes made to errors (like what you reported) is related to the plug-in breaking with this version.

@jasonsaayman
Copy link
Member

@larlew can you give an example of this? I use Axios in a number of projects and am yet to have this issue?

@schmod
Copy link

schmod commented Jul 26, 2019

This appears to be a regression rather than a deliberate change, so the versioning conversation doesn't seem like it applies here...

@chinesedfan
Copy link
Collaborator

Closed due to lack of enough information and stale. Nobody gives a reproducible code example.

@axios axios locked and limited conversation to collaborators May 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants