problem in try/catch sequence..!

i have a problem in try/catch sequence…

i am assigning a value 2 to res variable in try seq…

i want that res value in catch seq…

main sequence(exit on success)
{
try seq(exit on failure)
{
if a!=2 // i will give input other than 2
{
set res to 2 in a MAP
}
}
catch seq(exit on done)
{
// i want to get res value here…ie in results i want to see res=2
}
}

this flow doesn’t produce res=2 in result…bcoz…in try seq…exit on failure IS will roll back pipeline values before seq…!.

any alternative…any java service…! plz…help me…:sad::confused:

anybody…???

1 Like

you can use pub.flow.getLastError to retrieve the state of the pipeline at the time the exception occurred.

1 Like

we have to use that flow step in catch block…?i used that…but still no visible of res…i think once we get out of try block with exit on failure…all variables in try block can’t be accessed in catch block…any alternative…?any java services…?

plz…try above code in developer…and help me…

thanks…!:sad:

OK,

I think your problem is the “Exit and signal failure”.

Try “WmPublic/pub.flow:throwExceptionForRetry” instead, in order to throw a “real” error.

Then you will see the pipeline in the lastError document after the call of getLastError.

Did you check in LastError/Pipeline…?

The information Arnaud provided is the thing to do (exit and signal error isn’t the problem though). Call getLastError. It returns a document. One of the fields is “pipeline”, which is a document holding all pipeline vars as they were at the time of the error.

It won’t show you the pipeline contents within Developer. You’ll need to explicitly add and map variables that you want out of the pipeline document. That means, modify the “pipeline” document to add your “res” variable to it, then map it out to another var.

if you use “Exit with signal failure”, the getlastError return no document.

thank you very much…!

i got it…!

thanks for your support…

That’s not what the code is doing. The SEQUENCE is exit on failure. The code isn’t doing EXIT signal failure. At least that’s how I’m reading the pseudocode.

Hi,

getLastError needs to be the first step in the catch sequence, otherwise the error state and information is lost.

Regards,
Holger