You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We ran into an issue I thought I'd let y'all know about in case it turns out to be a bug. I am making a call:
axios.post('/foo/.svc/r/GetHappyStuff', {
<arguments go here>
},{
cancelToken: cancelToken.token
}).then((resp) => {
if (resp.data) {
const res = resp.data.GetHappyResult
if (res && res.succeeded) {
// successful
}
}
}).catch((err) => {
console.error(err);
});
Looking in the Network tab of Chrome's dev tools I can see that the call completes successfully, and I can see the result in the Preview & Response tabs:
So the weird thing is that in the .then, I can write resp out the console and see the data. I can write out resp.data and see the same, and the if (resp.data) evaluates to true. As soon as I try and access the .GetHappyResult in any way, such as setting up the res variable, it will suddenly have a value of undefined.
What we have determined through pain / trial / error is that the contents of GetHappyResult are failing to parse through the JSON parser because there are some values which got written as NaN which causes the parser to barf... but it looks like that is being eaten and we happily try and use the value down the road where things fail.
Anyway, we've fixed this but I wanted to share our experience since this has been pretty painful and maybe something could be done to expose this kind of error. :-)
Context
axios version: v. 0.15.0
Environment: Node v6.11.1, Chrome Version 66.0.3359.139 (Official Build) (64-bit), windows 7
The text was updated successfully, but these errors were encountered:
Thanks so much for the response. That's a great solution! I'd lean more towards a console.error personally though. Any chance this could get officially included? Have you created a PR?
Summary
We ran into an issue I thought I'd let y'all know about in case it turns out to be a bug. I am making a call:
Looking in the Network tab of Chrome's dev tools I can see that the call completes successfully, and I can see the result in the Preview & Response tabs:
So the weird thing is that in the .then, I can write resp out the console and see the data. I can write out resp.data and see the same, and the if (resp.data) evaluates to true. As soon as I try and access the .GetHappyResult in any way, such as setting up the res variable, it will suddenly have a value of undefined.
What we have determined through pain / trial / error is that the contents of GetHappyResult are failing to parse through the JSON parser because there are some values which got written as NaN which causes the parser to barf... but it looks like that is being eaten and we happily try and use the value down the road where things fail.
Anyway, we've fixed this but I wanted to share our experience since this has been pretty painful and maybe something could be done to expose this kind of error. :-)
Context
The text was updated successfully, but these errors were encountered: