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

Better error message for missing url #3110

Closed
shayneo opened this issue Jul 9, 2020 · 2 comments
Closed

Better error message for missing url #3110

shayneo opened this issue Jul 9, 2020 · 2 comments

Comments

@shayneo
Copy link

shayneo commented Jul 9, 2020

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

The error that occurs when making an axios request with a url that is undefined is unclear. This is problematic because I often write code that programmatically generates the url for the request, or uses the response from a previous request to compose the next request.

Describe the solution you'd like

If a url is falsey in the request config, throw a very clear error that indicates that no url was provided

Describe alternatives you've considered

Making sure I write better code that doesn't generate undefined urls

Additional context

This is the error generated currently Uncaught (in promise) TypeError: can't access property "protocol", n is undefined, which is not the most helpful in terms of pinpointing the issue.

@jasonsaayman
Copy link
Member

Closed by #3791

@metametadata
Copy link

Reproducible in 1.4.0 (https://unpkg.com/axios@1.4.0/dist/axios.min.js). E.g. on calling axios({}):

Uncaught (in promise) TypeError: n is undefined
    we isURLSameOrigin.js:57
    xhr xhr.js:186
    xhr xhr.js:49
    Ae dispatchRequest.js:51
    value Axios.js:148
    a bind.js:5
    <anonymous> debugger eval code:1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants