Android Question Try-Catch are several levels possible here?

Gunnar Daehling

Active Member
Licensed User
Hello,

one of my apps has the following problem:

B4X:
Try
                    
Catch
   ' Another problem can occur in this segment
End Try
I could solve that with this construction:

B4X:
Try
                    
Catch
   Try
                        
   Catch    
                        
   End Try
End Try
I am not sure if this can be programmed. Or could that cause problems?

Best regards,
Gunnar
 

Erel

Administrator
Staff member
Licensed User
It can cause unforseen problems in some devices
Try / Catch blocks do not behave differently on different devices.

You can nest multiple blocks. Your code is valid.
The debugger might be more fragile with complex catch blocks. However such issues will not happen in release mode.
 

Gunnar Daehling

Active Member
Licensed User
Try / Catch blocks do not behave differently on different devices.

You can nest multiple blocks. Your code is valid.
The debugger might be more fragile with complex catch blocks. However such issues will not happen in release mode.
I'm really glad to hear that. A big thank you.:)

Best regards,
Gunnar
 
Top