I would like to know how to continue looping after throwing exception and document fail at total count.
example: fail document 010291.xml at count 4000 and continue loop again.
xquery version "1.0-ml";
try {
let $uris := cts:uris((),(),
cts:and-query(
cts:collection-query("/TRA")
)
)[1 to 200000]
for $uri in $uris
return
if (fn:exists(doc($uri))) then ()
else $uri,
xdmp:elapsed-time()
} catch($err) {
"received the following exception: ", $err
}
Put the try-catch statement inside the loop
xquery version "1.0-ml";
let $uris := cts:uris((),(),
cts:and-query(
cts:collection-query("/TRA")
)
)[1 to 200000]
for $uri in $uris
return
try{(
if (fn:exists(doc($uri)))
then ()
else $uri,
xdmp:elapsed-time()
)
} catch($err) {
"received the following exception: ", $err
}