Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-5294] iOS: HTTPClient onerror response is returning "undefined"

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionCannot Reproduce
Resolution Date2016-11-02T11:41:38.000+0000
Affected Version/sRelease 1.8.0
Fix Version/sn/a
ComponentsiOS
Labelsapi, parity, tbs-2.1.0
ReporterEric Merriman
AssigneeHans Knöchel
Created2011-09-15T14:49:28.000+0000
Updated2017-03-31T17:29:33.000+0000

Description

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

Attachments

FileDateSize
onerrorResult.png2011-09-15T14:49:28.000+000086872

Comments

  1. Hans Knöchel 2016-11-02

    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.
  2. Lee Morris 2017-03-31

    Closing ticket with reference to the above comment.

JSON Source