Httutils. Get the message error after HttpUtils.IsSuccess return false

miguelconde

Member
Licensed User
Longtime User
Friends, I am a rookie with B4A, however through the power of this tool I could move my mobile application by 50% in just one week. I have a question about httputils. How do I capture the error message or description when HttpUtils.IsSuccess method is false?. Currently i am sending a generic message, something like "An error occurred with the server", but I wan show or get the message
that i can see in the log, in my case I am downloading a file, if not exist on the server, I can see the message in the LOG. "File does not exist", I need to get that message. Thanks for everything and congratulations for this tools.
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
You will need to modify the code in order to fetch the error message.
The error is logged in HttpUtilsService.HandleError:
B4X:
Sub HandleError(TaskId As Int, Reason As String)
   Dim link As String
   link = TaskToRequest.Get(TaskId)
   Log("Error. Url=" & link & " Message=" & Reason)
End Sub

You can add a Map and store the link and error as key and value.
 
Upvote 0

miguelconde

Member
Licensed User
Longtime User
You will need to modify the code in order to fetch the error message.
The error is logged in HttpUtilsService.HandleError:
B4X:
Sub HandleError(TaskId As Int, Reason As String)
   Dim link As String
   link = TaskToRequest.Get(TaskId)
   Log("Error. Url=" & link & " Message=" & Reason)
End Sub

You can add a Map and store the link and error as key and value.

Thank you very much Erel!, very useful response
 
Upvote 0
Top