Exception Handling - RE Framework

Guys,

Need a help. I am using RE Framework in my project. I have one transaction. Under this transaction number 1 (get transaction data) > in the process > I am executing a for-each row loop and performing multiple process there. Say i am reading an excel and have to perform few operations for each row. In specific cases, any one of the row can fail.

REF handles 2 exceptions > Business exception and System. Business exception ends the current transaction, goes to the second transaction. and the system exception closes the application and starts with the next transaction as well. For one record that gets failed inside the for each row > I should not skip the transaction itself. Instead, i should mark that specific record as failed and process the next row of the for each. Once all records in the for-each is complete, i need to go next transaction.

In any of the business exception on the second or third row of my iteration in process … i am skipping the other rows of for-each. how to handle this? any idea?

Let me know if you cant understand the situation. Will try to explain in better way.

Perhaps I’m misunderstanding, but I think you should re-think your definition of a transaction. It sounds to me like an individual transaction should be defined as a single row of the excel sheet.

If you decide to have multiple sub-transactions, then you need to essentially build your own error handling for this as it’s not built into the reframework, unless you are calling it as a “service” in which case each service is essentially built as a standalone process with it’s own reframework.

1 Like

Hi @Pradeep.Robot
I agree with @Dave, you might need to rethink the approach if you’re running for loop inside a transaction.

However, if you must use it this way, you could consider using one or more try-catch blocks for the sub-processes.
The catch block won’t generate an exception, instead you can just mark the item as invalid, move on to the next item in loop.
In cases where you want to skip the subsequent rows, you can use Break activity to break out of the for loop and move to the next sub-process.

1 Like

I cannot change the process because, in my use case > each transaction has to handle multiple row item in an application. For eg… Claim processing multiple records inside it. Claim numbers would be the transaction item… and the records are the sub transactions.

So, in this case - if you mean to build my own error handling? like custom exception? how could we do that?

In your first paragraph it mentions that you only have 1 transaction. Will you always have 1 transaction? If so, then you should separate it out into separate workflows where you have a lower level transaction (e.g. each record is considered the transaction rather than each claim, since you’ll only have 1 claim each time it runs)

If I misunderstood, then I apologize. For error handling, I mean that reframework isn’t built for handling subtransactions. You’ll have to modify it to build in your own error handling. That doesnt mean custom exceptions, but it does mean you have to handle the exceptions within your code separately (usually with try-catch statements)

2 Likes

This sounds good. So please explain me this, if i handle a try catch for a sub transaction, In the exception - you dont want me to throw any specific exception and skip to Business/system exception… instead - in the exception block, should i need to assign that specific row as invalid? but how could i discontinue the remaining invoke methods?

for eg… for each sub transaction, say i am processing Addition of 2 numbers (as a invoke process), Multiplication of 2 numbers (as invoke process) and Division of 2 numbers (as a invoke process).
And, if Addition process gets successful > goes to Multiplication process : and i receive error here. As adviced, i am catching an exception here. but not throwing as business/system. In this case… the process continue to perform the division method as well correct?

Intention of throwing is : other process will not be followed. if am wrong - can you please explain me the right way of doing it?

Here is a skeleton of what that might look like.

Each Invoke Workflow File activity sits inside a dedicated try-catch block to catch exceptions during that step of the process.
I have expanded the ‘try’ section of Sub-Process 1 and the ‘catch’ section of Sub-Process 2 but they all have similar try and catch blocks.
The catch blck has a Break activity upon encountering an exception.
This will break out of the for loop, thereby skipping any subsequent steps.

Here is the file for your reference.
ExceptionHandlingSubflow.xaml (17.3 KB)
I hope this helps.

2 Likes

Thanks for your explanation, So this will break out of the for loop and will process the next record of the For loop? or will exit the process itself. I would need to process the third record if the second record is failed (inside the for loop).

Also, if i am throwing business/exception inside the try of this process (breaking loop process), will that be thrown to business/system exceptions? or jus will try to break out of the loop?

I mean, sometimes when the application is down or crashing - i am throwing system exception. In this case, if am breaking out of the loop while catching this sub process… whatever i throw (system exception) from try still be catched in the system exception place correct?

Instead of the ‘break’ activity, you would use the ‘continue’ activity - this would skip the rest of the current iteration and go onto the next item in the for each loop

2 Likes

I have a similar situation, i have 4 sheets in excel to be processed. I am giving the 4 sheets as transaction item and each row of the sheet as sub transactions.After each sub transaction i am updating status in excel.

The problem coming is I am not able handle exceptions and retries which is in the framework. Whenever a system exception occurs it goes to infinite loop.

Is this the right way to do or should i give the each sheet as transaction item and use a for each to loop through each row? Then how will i handle exceptions and update excel.?


Here invitetoworkspace is the 1st transaction and transaction items are rows in the sheet.