iOS Question Problem with job.ErrorMessage

Pablo Torres

Active Member
Licensed User
Longtime User
Hello everyone,
I have a server running a service made with B4J and 2 apps (B4A and B4i) that connect with them.
In some case I need to answer with an error number and an error message from the service that I need to catch and use it in the apps
Let me show you the code, it's very easy:
B4J Service:
Case "F"
        resp.SendError(15,"355238")
    Case "G"
        resp.SendError(16,"974520")
And this is the code in B4A and B4i:
B4i and B4A:
    j.PostString(strServidor,"Data=" & EncryptText(MyJG.ToString))
    wait for (j) JobDone (job As HttpJob)
    If job.Success Then
        ...
    Else
        Select Case job.Response.StatusCode
            Case 15
                lblResultado.Text="something goes here " & job.ErrorMessage
            Case 16
                lblResultado.Text="something different goes here " & job.ErrorMessage
        End Select
    end if
In B4A works perfect, job.ErrorMessage receives "355238", "974520" or the number (string in fact) that I send from B4J, but in B4i it does not receive the job.ErrorMessage, only the Status code.
How can I receive in B4i the ErrorMessage?

@Erel told me that I shouldn't expect it to work because I'm using non-standard status codes... but it works fines and smoothly on B4A, why it does not work in B4i?

I also read a lot of posts about this problem but did not find any solution, in fact in a post made in 2020 it says "next B4i release will have this fixed" or something like that ... but I guess is not solved

Any helps will be highly appreciated

Many Thanks
 

hatzisn

Well-Known Member
Licensed User
Longtime User
Why don't you reply to the request with a JSON derived from a map with all the values you want?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
@Erel told me that I shouldn't expect it to work because I'm using non-standard status codes... but it works fines and smoothly on B4A, why it does not work in B4i?
The underlying implementation is completely different. As I wrote, you shouldn't use non-standard status codes if you want your program to work reliably.
Status codes: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status

in fact in a post made in 2020 it says "next B4i release will have this fixed" or something like that ... but I guess is not solved
You are guessing wrong. The issue was fixed. It might be a different issue then the one you encounter here.
 
Upvote 0
Top