Bug? Error not returned to the program in HttpUtils2Service

Informatix

Expert
Licensed User
Longtime User
In a project using a MySQL db, Job.ErrorMessage always returns "Internal server error" whatever error occurs on the DB side so I cannot do anything with it. It's because, in HttpUtils2Service, the ErrorResponse is sent to the log, and not returned to the program!
 

ArminKH

Well-Known Member
maybe you need to customize HttpUtils class by yourself(open source version)
https://www.b4x.com/android/forum/threads/download-huge-files-with-httputils2.30220/#content
upload_2016-3-6_12-51-1.png
 

Informatix

Expert
Licensed User
Longtime User
Here's my change:
B4X:
Sub hc_ResponseError (Response As OkHttpResponse, Reason As String, StatusCode As Int, TaskId As Int)
    Dim ErrMsg As String = Reason
    If Response <> Null Then
        ErrMsg = ErrMsg & CRLF & Response.ErrorResponse
        Log(Response.ErrorResponse.Replace("\n", CRLF))
        Response.Release
    End If
    CompleteJob(TaskId, False, ErrMsg)
End Sub
 
Top