"Throw" activity

Created by akaBot Support, Modified on Mon, 9 Dec, 2024 at 5:27 PM by akaBot Support

Contents

  1. Activity Program Name
  2. Description
  3. Properties
  4. Usage


1. Activity Program Name

System.Activities.Statements.Throw

2. Description

The Throw activity is used to explicitly throw exceptions during workflow execution.

  • Studio Version Up to 2.0.2.0:
    Quick Access: 
    Toolbox > Error Handling > Throw
  • Studio Version From 2.0.3.0:
    Quick Access: 
    Toolbox > System > Error Handling > Throw

Note:

  • Verified with Studio Version: 2.1.1.2
  • Some terminology may differ based on the version.


3. Properties


Property Category
Property Name
Input Field
Description
Others
Public
Checkbox
Logs the variables and arguments within the activity to a log file and pushes them to Center.
Display Name
String
The name reflected in the activity on the designer panel.
Throw Exception
Exception Type (e.g., new Exception)
Defines the exception type to be thrown.


4. Usage

Here’s how you can configure the Throw activity to throw an exception if the target element is not found (e.g., "Welcome to akaBot Support").


Drag and drop the System > Error Handling > Try Catch activity into the workflow.


Drag and drop the Windows > Element Exists activity into the Try block.

Click "Pick target element" and select the element labeled "Welcome to akaBot Support!".


Note: Since the akaBot Portal is not opened automatically during workflow execution, the 
Element Exists activity is used here.


In the activity’s Output > Element Exists property, specify a Boolean variable (e.g., blElement).

Drag and drop the System > Control Flow > If activity.

Set its Condition property to the Boolean variable or VB expression (e.g., blElement = True).

Drag and drop the System > Primitives > Write Line activity into the Then field.

Set its Text property to a string (e.g.,  "Have elements").


Drag and drop the System > Error Handling > Throw activity into the Else field.

Define its Throw Exception property as the exception type (e.g., new Exception(" Not have elements")).


In the Catches block of the Try Catch activity, click Add New Catch.

Choose System.Exception.

Drag and drop the System > Primitives > Write Line activity into the Catch block.

Set its Text property to exception.Message.

Close the akaBot Support Portal site and run the workflow by clicking Home > Start or pressing F5.

Verification

  • If the element exists: The output panel displays "Element exists".
  • If the element does not exist: The Throw activity triggers an exception, and the output panel displays "Not have elements"


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article