Thank you Christian
Unfortunately, due to the semantics of XQuery Update, there is no chance to make this work, because all updating functions will first be moved to the pending update list [1] and processed after the query itself has been evaluated.
So my suspicion of the cause was correct - I’m getting better at this XQuery stuff.
Instead, you should probably try to avoid having any other BaseX instances creating or accessing databases at the same time. If this can be ensured, BXDB0007 should never be raised.
And, it my ideal world this would of course be true, sadly I’ve already encountered this error following a DB corruption after running out of disk space. And it’s not just that error I’d like to trap - I’d like to be able to report back to me if a request has failed for any reason.
Is it possible to do something by using rest:forward or http:send-request? I see that rest:forward is suggested for use in situations where you have multiple XQuery updates in a row.
Many thanks, James