Description:
While trying to verify and close TIMOB-2383, I ran a modified version of the sample code (From Dawson) listed in the bug. While the code did trigger the "onerror" with 4xx and 5xx response codes, the alert produced a response of "Undefined" for e.error. This functions as expected on Android. Due to TIMOB-2383, I was unable to test this in 1.7.2.
{CODE}
var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
var lbl = Ti.UI.createLabel({
text: 'Waiting for response...', color: '#000',
top: 40, left: 10,
width: 300
});
win.add(lbl);
win.open();
var xhr = Ti.Network.createHTTPClient({
onload: function(e) {
alert('FAIL! "onload" ran when we got the error code ' + this.status + ' from the server!');
},
onerror: function(e) {
alert('Error: ' + e.error);
}
});
xhr.open('GET', '
http://appc.me/test/simulateresponse?code=404');
xhr.send();
{CODE}
Steps to reproduce:
1) Create a new mobile project in studio targeting SDK 1.8.0
2) Use the attached code for your app.js
3) Run in simulator or on iOS device
Result:
Alert produced as seen in that attached image (note, this is from my slightly modified version of the attached code above)
Expected:
And alert produced with text similar to: "Error: This is a custom status description for error code 500!"
Notes:
Could not test in 1.7.2
Does not occur on Android
Hi Eric. Just tested with our recent SDK's (5.5.x, 6.x) and am not able to reproduce the issue anymore. I guess it was fixed over the last 5 years, hehe.
Closing ticket with reference to the above comment.