B b4auser1 Well-Known Member Licensed User Longtime User Mar 16, 2016 #1 In B4A I used Response.ErrorResponse to get Error response. I didn't find this method in B4i implementation and tried to find an alternative. Could I use Response.GetString instead of Response.ErrorResponse ? Code: Copy Sub hc_ResponseError (Response As HttpResponse, Reason As String, StatusCode As Int, TaskId As Int) Log("Error response: " & Response.GetString & ", status code: " & StatusCode) CompleteJob(TaskId, False, Reason, Null) End Sub Code: Copy /** * Returns a the server response as a string using UTF8 encoding. *This method is only valid inside the ResponseSuccess event. */ - (NSString *)GetString;
In B4A I used Response.ErrorResponse to get Error response. I didn't find this method in B4i implementation and tried to find an alternative. Could I use Response.GetString instead of Response.ErrorResponse ? Code: Copy Sub hc_ResponseError (Response As HttpResponse, Reason As String, StatusCode As Int, TaskId As Int) Log("Error response: " & Response.GetString & ", status code: " & StatusCode) CompleteJob(TaskId, False, Reason, Null) End Sub Code: Copy /** * Returns a the server response as a string using UTF8 encoding. *This method is only valid inside the ResponseSuccess event. */ - (NSString *)GetString;
Erel B4X founder Staff member Licensed User Longtime User Mar 16, 2016 #2 Not sure that I understand. Is this a bug report or a question?
B b4auser1 Well-Known Member Licensed User Longtime User Mar 16, 2016 #3 If I can use Response.GetString instead of Response.ErrorResponse, then comment "This method is only valid inside the ResponseSuccess event" is incorrect. otherwise code Log("Error response: " & Response.GetString & ", status code: " & StatusCode) Click to expand... is incorrect, because Response.GetString can't be used inside hc_ResponseError.
If I can use Response.GetString instead of Response.ErrorResponse, then comment "This method is only valid inside the ResponseSuccess event" is incorrect. otherwise code Log("Error response: " & Response.GetString & ", status code: " & StatusCode) Click to expand... is incorrect, because Response.GetString can't be used inside hc_ResponseError.
Erel B4X founder Staff member Licensed User Longtime User Mar 17, 2016 #4 I see. The log command should be: Log("ResponseError: " & Reason & ", status code: " & StatusCode)
B b4auser1 Well-Known Member Licensed User Longtime User Mar 17, 2016 #5 So in B4i I should use Reason instead of Response.ErrorResponse in B4A ?