Try&Catch Extension - An extension to code with try and catch


Hi everyone, I hope you are all good. Today I come with a little extension but very useful for you. This extension allows you to call methods and set the properties with try and catch. What is Try & Catch? Try and catch place around the code to catch the exception like if you have a list of 3 items and you are selecting 4th then it will throw a runtime error with a dialog that impact very bad on UI and to user. So that’s why I come up with this little extension. It has few blocks that will help you to catch the exception while calling the method and setting the properties of the components. As it works through Java reflection so you can also call method of extensions even of this extension.

So let see its blocks and their documentation.

All Blocks



component_event (4)

This event raises when any exception is caught. It gives the exception in string. For ex, java.lang.ArrayIndexOutOfBoundsException.

component_method (2)

This block is for selecting the item of a list with catch exceptions. If the index is greater than the list length then it will simply call the catch event with java.lang.ArrayIndexOutOfBoundsException exception.

component_method (3)

This block invokes the methods and properties of the component as well as extensions. You just need to pass the component or extension to component parmaeter and method or property name to the name parameter and then just provide a list of parameters of that method that you are calling and the method will be invoke or called. If the called method is void type then you will get nothing in return but if not then it will return the result of the invoked or called method. If any error occured then catch event will be raised.

I hope you understood the documentaion. So let’s usage of it.


There is very simple blocks and usage.


Selecting a item from a list for given index.


Calling a return a method of a label. The same way you can call the void methods of the extension and designer property of the components. Just remember to pass the parameter for the method that you’re calling. For void method you should use the Evaluate but ignore result block as the called method will return null (because the method is void) .


Calling a return method of the extension.

Using Select List Item


It will trhow a runtime error on screen bbut if you will use this extension then it will return you the exception.
Like this,


And Catch event will be raised too.


Open Source


Thanks to @Shreyash for his super Rush .
Thanks @yusufcihan for keeping its Dynamic Component extension Open Source it helped me a lot.

Suggestion and issue are welcome

If you like the extension then like the topic
Thank You All


If you like my work then donate if you can :slightly_smiling_face:


This is going to be very useful, thanks very much! :smiley:


i need this extension, useful extension… thanks



1 Like


Can you please put other usage examples? I didn’t quite understand how to use the extension.

1 Like

What example you want? Can you tell me I’ll try to post it.

1 Like

HI firend, is this runtime error supposed to be normal? Installing the apk and in the companion the errors are the same.

1 Like

Can you show us your blocks?

1 Like

They are in the background, they are basically the same as the example.

Can it catch something like this ?


1 Like

No. Extension could not call inbuilt blocks functions. That’s why there is a separate block for select list item in extension. I could add such a block for segment too. However, I am trying to find a more easy way to do code in try catch. It will be lot easier then. Current version of extension make a lot of efforts to do code.

1 Like

Pretty cool extension.

You can add support for other procedures using this guide.

1 Like

Thank you. I would take a look into it.

Try&Catch v1.1.0

Second version of the Try&Catch extension. This update contains some new blocks and have some changed.

New Blocks

  • Exception


    This is the same block as Catch. It just has a extra parameter that returns exception name and error return the error message of exception. I have not deleted the Catch block because it may break your projects. Now you can migrate to this block from Catch if you want. Both event will be raised when any exception caught.

  • Call Procedure


    This block calls a procedure with a list of parameters in try catch. This is most simple thing you can do with your blocks to catch the errors. You can use any block of any component in that procedure if any error occurs then the Exception and Catch event will be raised. Now you won’t need to use Call Method block to call every method of the component with try catch. Just move your whole blocks to a procedure and call the procedure with this block.

How to use

Here is an image of blocks that shows how to call the procedure with new block.

Update Extension

You can download the new version from the same above link on the first post.


Thanks @dora_paz for testing the extension.
I would really love to thanks Atom Developer for posting the sources code here :

And @zainulhassan too, Thank you for posting above link in your topic. It just made my work more simple.

Thank you
Sumit :wink:


When you posted the first version of the extension, I talked to you about showing what the error was. Remember?

is this extention catch the message of error without showing “End Application” error message ?