Skip to content

response interceptor should have request infomation on error #3606

@phil294

Description

@phil294

Describe the bug

This bugreport very similar to #315 which was implemented and fixed, however I think this is not solved yet. When the query params parsing process itself fails (before the request even started), the resulting error object does not contain request information, making it hard to debug, especially with as error reports.

To Reproduce

axios.get("", {
  params: {
    someParam: new Date(undefined)
  }
}).catch((e) => {
  console.log(e);
})

Only prints

RangeError: Invalid time value
    at Date.toISOString (<anonymous>)
    at parseValue (buildURL.js:53)
    at Object.forEach (utils.js:219)
    at serialize (buildURL.js:51)
    at Object.forEach (utils.js:225)
    at buildURL (buildURL.js:38)
    at dispatchXhrRequest (xhr.js:45)
    at new Promise (<anonymous>)
    at xhrAdapter (xhr.js:13)
    at dispatchRequest (dispatchRequest.js:53)

Expected behavior

I would expect the error to have information about the request (uri, config, etc) just like when the error is thrown on server response error.

Environment

  • Axios Version 0.21.1
  • Adapter http
  • Browser chromium
  • Browser Version 87.0.4280.141
  • Node.js Version 12.20.0
  • OS: Manjaro 20.2.1
  • Additional Library Versions none

Additional context/Screenshots

dont have any. – I dont think that omitting this category should result in the automatic closing of an issue :-/

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions