Exception question

Hi,

I have a main flow calling a reusable component.

In the reusable component, I have data validation and data entry sections. In the data validation, I will be throwing a business exception(1).

In the data entry section I might get a system exception and I am also throwing a business exception2.

What do I need to do if the exceptions have to reach the calling workflow, which is from REFramework.

Thank you,

Hi @A_Learner

Step 1: Throwing Exceptions in Reusable Components

  • Use the Throw activity to raise exceptions:
    • For business logic failures: Throw new BusinessRuleException(“Validation failed”)
    • For system errors:Throw new Exception(“Unexpected system error”)

Step 2: Exception Propagation to REFramework

  • If you do not catch the exception inside the reusable component, it will bubble up to the calling workflow (e.g., Process.xaml).
  • REFramework has a Try Catch block in Process.xaml that captures both System.Exception and BusinessRuleException.
  • System.Exception: Triggers a transition to the Init state, restarting the process.
  • BusinessRuleException: Skips to the next transaction item without restarting

Step 3: When to Use Try-Catch Inside Reusable Components

  • Use Try Catch inside the component only if:
    • You want to handle the exception locally (e.g., retry, log, cleanup).
    • You plan to rethrow the exception to let REFramework handle it.
  • Example of rethrowing:
    Catch ex As BusinessRuleException
    Throw ex

Step 4: Invoking the Component

  • Use Invoke Workflow File activity to call the reusable component.
  • This activity does not suppress exceptions unless wrapped in a Try Catch.
  • If you want REFramework to handle exceptions:
    • Do not wrap the Invoke Workflow File in a Try Catch inside Process.xaml.

Please try these steps. and let us know your output.

Happy Automation!

Hi @A_Learner

Just throw the exceptions in your component without catching them. That way, REframework can catch them and handle things like retries or logging automatically.

Happy Automation

@A_Learner
The REFramework is designed to handle all types of exceptions.
For a Business Exception, it does not retry the transaction item, whereas for an Application Exception, it retries the transaction item.

Simply debug the process, and it will take you to the “SetTransactionStatus.xaml” file. Check the argument values there, and you’ll find the answer to your queries.

Mark it as the solution if it helped you resolve your queries.