Android Question [Solved] B4AException cannot be cast ....String

mw71

Active Member
Licensed User
Hi,

with this Code i get a List from the FTP Server:
B4X:
FTP.Initialize("FTP",server,port,user,passwort)    'server,port,user,passwort-> string variable
FTP.PassiveMode=True
FTP.List("/")

Wait For FTP_ListCompleted (ServerPath As String, Success As Boolean, FolderS() As FTPEntry, Files() As FTPEntry)
it works fine


Now I made a mistake, entered the wrong FTP address
In this case, Success is false and i call:

B4X:
CallSubDelayed3(Target,"FTP_Backup_Fin",3,LastException)
The "Target" for LastException is a String Variable.
B4X:
Wait For FTP_Backup_Fin(SuccessCode as Byte, Error as String)
there crashes the app (with the wrong FTP Server, other errors view o.k.)

LastException is:
(GaiException) android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname)

and Crash with:
java.lang.ClassCastException: anywheresoftware.b4a.objects.B4AException cannot be cast to java.lang.String

why the LastException cant cast to string??
 

mw71

Active Member
Licensed User
thanks, especially Erel.
When changing to Exception I have seen in the Help (Tooltip) that there (Last)Exception.Message. This works fine.
 
Top