Error Handling in flow svcs

In a try-catch sequence,
When “EXIT $Flow and signal FAILURE” is used in try block, the pipeline
variables vanish (in the catch block) excepting for the inputs to the main service. I need some of those variables for post-processing of errors. Can someone tell me how to retain the pipeline variables after erroring out.

Thanks
Vijay.

They should be in a object called lastError.
So you should be able to retrieve it thru lastError\myVar.

HTH

Hi Chris ,
Not always. Its very erratic, sometimes they are and sometimes not. My test services behave well, but the current production code does not. I even looked at the nested lastErrors but could not find the variables I need. Initially I thought they were dropped in other preceding services , but found that they were intact. The variable just vanishes after the “EXIT $Flow and signal FAILURE” line. Can I set some variable so that it is persistent even after the EXIT.

Can this problem be attributed webmethods bug. The version I am working on is 6.1.

Thanks

Hi Vijay

If you set the variables you wish to keep before you start the try/catch (set them to “”), you can use them. Otherwise, when first used within the try/catch, they will be seen as local variables and thus not available outside the try/catch when the catch is called.

Hope this helps, Chris

Chris (S), thanks for pointing that out. We took a different approach previously, wherein you access the local variable through %/lastError/pipeline/myVar%, since the entire local pipeline is returned in an exception in this way. However, I’ve never attempted your approach and in some situations that seems clearer.

I’ve run into this before with 4.6. The exit flow and signal failure does not act the same way as a service exception thrown in a Java service. The trick we used was to create a Java service that accepted input parms to indicate the error (presumably you know what it is since you were doing exit flow and signal failure) and then throw an exception (ServiceError I think). Then getLastError will have what you expect.

HTH.

Rob

Thanks to everyone who posted the solutions. I got an opportunity to
try and implement a solution today.
Christian Schuit : I have used your method with success. I am little
surprised that webMethods manual never talks about local variables or scope of a variable. They need to update their manuals.

Michael A. Rossi :Your approach is the first one I tried. the variables were missing in “lastError/pipeline/myVar”, I am not sure
why. We are using 6.1 version. Which version are you using.

Rob Eamon : I haven’t tried your appraoch, but its frustrating to know that the exit $flow behaves differently than ServiceError.
Did you try this approach with V6.1 ?

Thanks
Vijay .

Vijay,

As long as you dont explicity drop the variables and any error occurs in the execution of flowsvc will be obtained by getLastError this variable substituion will work %lastError/pipeline/myVar%…in any verion of IS,So michael solution will work,step thru the flow whether dropping is done before you see the exception.

or else follow Chris schuit solution which you got success.

HTH,
RMG.

Vijay: Have not yet tried 6.1 to see if there is any difference.

Hi Vijay

There is a lot more to webMental then there is documented :wink:

Best of luck, Chris