I would like to develop such module in MarkLogic JS API: If conditional checking is good, then proceed the next code blocks. If not, then besides try/catch, how can I exit the whole module? The purpose is that I can not only get the error message, exit the module safely but I don't need to encapsulate all the codes inside the try/catch. Is there such function in MarkLogic? I couldn't find it. And lots of JS (not MarkLogic JS API) error handling doesn't work in MarkLogic.
1 Answers
0
votes
I may not understand the problem correctly, but I'll offer a few suggestions:
To exit a module due to a failure condition, you can use the fn.error() function http://docs.marklogic.com/fn.error
To do the equivalent of a return in a JavaScript main module, one simple approach is to move all of the code into a function and call the function, which can then return at any point.
Hoping that's useful,