Errorlabel

Erel

B4X founder
Staff member
Licensed User
Longtime User
Basic4android uses Try... Catch... End Try blocks.
For example:
B4X:
    Try
        Dim in As InputStream
        in = File.OpenInput(File.DirInternal, "SomeMissingFile.txt")
        '...
    Catch
        Log(LastException)
    End Try
    If in.IsInitialized Then in.Close
When an exception is raised inside the Try... Catch block, the execution of this block stops and it continues in the Catch... End Try block. If no exception is raised then the Catch... End Try will not be executed.
You can use the LastException predefined object to get more information about the exception.
 
Upvote 0

linum

Active Member
Licensed User
I'm going to wet my pants... I love the "Try" method and I was always wishing it was available on Basic4PocketPc. Will it ever be implemented on B4PPC?
 
Upvote 0

derez

Expert
Licensed User
Longtime User
Don't do that, hold on...
What is wrong with errorlabel in b4ppc ? it catches the errors and sends the program to a label - it is about the same !
 
Upvote 0

mjcoon

Well-Known Member
Licensed User
What is wrong with errorlabel in b4ppc ? it catches the errors and sends the program to a label - it is about the same !

Functionally the same, as is the use of GoTo to produce the same effect as If ... Then ... Else.

And have you never forgotten to put a Return statement before the errorlabel, so that the error is triggered every time? What, never? ;)

Mike.
 
Upvote 0
Top