Android Question OkHttpUtils V2.62

walterf25

Expert
Licensed User
Longtime User
Hello everyone, I just updgraded B4A to Version 8.3, i'm not sure if this is related or not but i am getting this error when doing a Get request.
catcherror: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
Below is my code:
B4X:
Sub btnSignIn_Click
    Dim j As HttpJob
    j.Initialize("authenticate", Me)
    Log("requesting....")
    j.Download(baseurl&authenticate&"4321")
    ''Log("request done...")
    j.GetRequest.SetHeader("Authorization", "Basic aGhfdGVzdDpiaXMyNDI4")
    j.GetRequest.SetHeader("Cache-Control", "no-cache")
    j.GetRequest.SetHeader("X-CLIENT-ID", "2100")
    Log("waiting for job to be done..")
    Wait for (j) JobDone(j As HttpJob)
    Log("job done...")
    Try
        If j.Success Then
            Log("response: " & j.GetString)
       
        Else
            Log("error: " & j.GetString)
        End If
    Catch
        Log("catcherror: " & LastException.Message)
    End Try
End Sub

The strange thing is that I do get a response from the server first, then i get the error above.
This are the full logs i get

If i comment out the Try Catch part i get this error:

I know there is a problem with the server when I try to authenticate but that is not an issue at this point, what i need to understand is why am I getting the open failed: ENOENT (No such file or directory) error.

Anyone else experiencing this problem?

Thanks,
Walter
 

walterf25

Expert
Licensed User
Longtime User
You cannot call Job.GetString if Success is not true. You should check Job.ErrorMessage instead.
Argh, thanks Erel, so stupid on my part, it is fixed now.

Thanks,
Walter
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…