Skip to content

Toro Cloud Dev Center


Gloop block icon

Block steps

Block steps in Gloop are the same as using braces ({}) in Java and other languages. Block steps are used to group steps together, and are also used to wrap steps in try-catch, try-finally, and try-catch-finally parts. Also, any declared variable inside a block step will only be visible to its children - similar to variable scopes in Java.

The type of block step can be changed by setting the Block Type property. When the block step is selected, simply click and choose the new block type in the Properties view:

Changing a block step's type

Changing a block step's type

Exception handling in Gloop

When a service encounters an exception, it will iterate up the Gloop stack trace until it finds a catch block (exactly the same way it would in Java). If no catch is found, the exception is thrown out of the Gloop engine and back to Martini.

When you are in the catch section of a block step in Martini, a new variable called $gloopException will appear, which wraps the underlying exception that was thrown. This is where you should handle exceptions.

The catch section of a block step

The catch section of a block step

Adding block steps

Like any other step in Gloop, you can use the add button, hotkeys, or the content-assist menu to add a block step. However, Martini also has some convenient, pre-configured entries in the content-assist, too! These extra selections allow you to add pre-configured block steps in any format you like (try-catch, try-finally, and try-catch-finally).

Adding a block step

Adding a block step

Quick fixes

Martini also detects when you have a step in your service that throws an exception and isn't wrapped in a try-catch. Fortunately, it's quick and easy to fix! When a warning or error presents itself in Gloop, right clicking on the icon will present you with a list of options to try and fix it.

Martini quick fix feature