{ "id": "63015", "key": "TIMOB-2383", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "11364", "description": "Mobile 1.8.0 M11", "name": "Sprint 2011-32", "archived": true, "released": true, "releaseDate": "2011-08-15" }, { "id": "11331", "description": "", "name": "Release 1.8.0", "archived": true, "released": true, "releaseDate": "2011-10-31" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-10-27T15:53:51.000+0000", "created": "2011-04-15T03:18:19.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [], "versions": [ { "id": "11244", "name": "Release 1.7.0", "archived": true, "released": true, "releaseDate": "2011-06-13" } ], "issuelinks": [ { "id": "12756", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "80364", "key": "TIMOB-5294", "fields": { "summary": "iOS: HTTPClient onerror response is returning \"undefined\"", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Low", "id": "4" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-10-27T15:53:51.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "{html}

When working with the HTTPClient, I was expecting a 404 response\r\nto trigger my \"onerror\" function, but it never did. Even a 500\r\n\"Internal Server Error\" response did not trigger the \"onerror\"\r\nfunction. Everything I tried just executed \"onload\", regardless of\r\nthe actual server's response.

\r\n

More useful behavior would be similar to jQuery's ajax\r\nmethod:
\r\nhttp://api.jquery.com/jQuery.ajax/

\r\n
{html}", "attachment": [], "flagged": false, "summary": "HTTPClient doesn't trigger \"onerror\" with 4xx and 5xx HTTP response codes", "creator": { "name": "vancelucas", "key": "vancelucas", "displayName": "Vance Lucas", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "vancelucas", "key": "vancelucas", "displayName": "Vance Lucas", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "158590", "author": { "name": "anagesh", "key": "anagesh", "displayName": "Anirudh Nagesh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This is reproducible on android too! \r\nAssociated helpdesk ticket: http://support-admin.appcelerator.com/display/9600\r\nIncreasing the customer priority to 'within release'.\r\nEx: The 'xhr_error.js' in kitchensink demonstrates the same.", "updateAuthor": { "name": "anagesh", "key": "anagesh", "displayName": "Anirudh Nagesh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-07-05T16:17:02.000+0000", "updated": "2011-07-05T16:17:02.000+0000" }, { "id": "159191", "author": { "name": "kclark", "key": "kclark", "displayName": "Kincy Clark", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Assigning back to Ani for sample code creation. ", "updateAuthor": { "name": "kclark", "key": "kclark", "displayName": "Kincy Clark", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-07-11T10:31:54.000+0000", "updated": "2011-07-11T10:31:54.000+0000" }, { "id": "159193", "author": { "name": "anagesh", "key": "anagesh", "displayName": "Anirudh Nagesh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Sample code is same as xhr_error.js in kitchensink. Have attached the same.\r\n{code:title=\"app.js\"}\r\nvar win=Titanium.UI.currentWindow;\r\n\r\nvar l1 = Titanium.UI.createLabel({\r\n\ttext:'UTF-8 GET',\r\n\tfont:{fontSize:16,fontWeight:'bold'},\r\n\ttop:10,\r\n\twidth:300,\r\n\tleft:10,\r\n\theight:'auto'\r\n});\r\nwin.add(l1);\r\n\r\nvar l2 = Titanium.UI.createLabel({\r\n\ttext:'Waiting for response...',\r\n\tfont:{fontSize:13},\r\n\ttop:40,\r\n\tleft:10,\r\n\twidth:300,\r\n\theight:'auto',\r\n\tcolor:'#888'\r\n});\r\nwin.add(l2);\r\n\r\nvar xhr = Titanium.Network.createHTTPClient();\r\n\r\nxhr.onload = function(e)\r\n{\r\n\tl2.text = e.responseText;\r\n\tTi.API.info('im inside onlaod');\r\n};\r\n\r\nxhr.onerror = function(e)\r\n{\r\n\tl2.text = e.error;\r\n\tTi.API.info('im inside onerror');\r\n};\r\n\r\n// open the client\r\nxhr.open('GET','http://www.fre100.com');\r\n\r\n// send the data\r\nxhr.send();\r\n\r\n{code}\r\n", "updateAuthor": { "name": "anagesh", "key": "anagesh", "displayName": "Anirudh Nagesh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-07-11T10:49:03.000+0000", "updated": "2011-07-11T10:49:03.000+0000" }, { "id": "160481", "author": { "name": "anagesh", "key": "anagesh", "displayName": "Anirudh Nagesh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I shall update this ticket with the server side code by EOD!", "updateAuthor": { "name": "anagesh", "key": "anagesh", "displayName": "Anirudh Nagesh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-07-25T10:00:14.000+0000", "updated": "2011-07-25T10:00:14.000+0000" }, { "id": "160761", "author": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "body": "I added an action to appc.me for testing this out. Change the \"code=\" to some other code (like 403, 500, etc) and the server will respond appropriately. If you look at the response sent from the server, you should also see a custom status description is getting returned as well.\r\n{code:title=app.js}\r\nvar win = Ti.UI.createWindow({ backgroundColor: '#fff' });\r\nvar lbl = Ti.UI.createLabel({\r\n text: 'Waiting for response...', color: '#000',\r\n top: 40, left: 10,\r\n width: 300\r\n});\r\nwin.add(lbl);\r\nwin.open();\r\n\r\nvar xhr = Ti.Network.createHTTPClient({\r\n onload: function(e) {\r\n alert('FAIL! \"onload\" ran when we got the error code ' + this.status + ' from the server!');\r\n },\r\n onerror: function(e) {\r\n alert('Error: ' + e.error);\r\n }\r\n});\r\nxhr.open('GET', 'http://appc.me/test/simulateresponse?code=404');\r\nxhr.send();\r\n{code}", "updateAuthor": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "created": "2011-07-27T11:23:18.000+0000", "updated": "2011-07-27T11:23:18.000+0000" }, { "id": "160764", "author": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "body": "WORKS properly on Android! Does not work on iPhone Simulator 4.3.", "updateAuthor": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "created": "2011-07-27T11:26:28.000+0000", "updated": "2011-07-27T11:26:28.000+0000" }, { "id": "160781", "author": { "name": "anagesh", "key": "anagesh", "displayName": "Anirudh Nagesh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Oh Dawson has done it already:) Thanks Dawson. Yes, it works fine on Android.", "updateAuthor": { "name": "anagesh", "key": "anagesh", "displayName": "Anirudh Nagesh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-07-27T12:50:11.000+0000", "updated": "2011-07-27T12:50:11.000+0000" }, { "id": "166233", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Onerror is now triggered when an error is returned, but the e.error is returning undefined. Closing this bug as fixed and opened another TIMOB-5294 describing the new problem. Verified fixed with Titanium Studio, build: 1.0.5.201109091616, SDK 1.8.0.v20110914184549 on an iPad 2, 4.3.5 and iPod touch 3rd Gen 4.0.2.", "updateAuthor": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-09-15T14:59:12.000+0000", "updated": "2011-09-15T14:59:12.000+0000" } ], "maxResults": 8, "total": 8, "startAt": 0 } } }