Problems with pubflowgetLastError in WM 61

I`m having a problem using getLastError in a “try-catch-like” sequence.

Im using, as many other probably do, the pub:flow:getLastError service to catch the exception thrown in the try sequence and also recover the pipeline (note there is a document in my pipeline when the exception is thrown.. a document that, BTW, is an element of an array Im iterating through when the exception is thrown).

When recovering the pipeline, WM Developer insists on telling me there is a document list in the pipeline, not the single document. I`ve noticed, however, that, inside the lastError object returned by the pub:flow:getLastError service, there is, indeed, a single document, not a document list.

Two questions:

  1. Is that the expected behavior? and
  2. If so, how do I refer to an element of a document list in a variable substitution expression? I mean…

when it is not an array, I can access the member “name” of a “person” document by using "%person/name%. How would the syntax be if “person” was a document list/array?

Thanks,

felipem

Hello,
You can access elements in an array with an index. So if person was an array then:

%person[0]/name%

This would allow you to access the first array element. This is similar behaviour when working with BRANCH and suppliying a switch component. You could also try to LOOP over the structure if you want each array element and then your single document syntax you stated would be appropriate.

Good day.