Widget javascript - How to check the validity of an XPath, an entity and an attribute?

The widget I'm working on is configured in HTML. Therefor the input parameters are not checked from within the modeler. I'm using mx.processort.get to retrieve information on a user. To make sure no unexpected errors arise, I need to check the validity of the XPath, the entity and the attribute provided. Is there a way to do this, apart from running the get statement? Running the get statement itself and hoping the error gets caught is not working. In my experience the error is not caught nicely and, therefor, can not be handled correctly. === edit === My previous statement about deleted accounts is not correct, that's due to a problem with anonymous users (I'll get back to that in another item). Furthermore, the error is caught, I found out - firebug helped me discover this where I had trouble using Chrome debugger to understand this. Next question I have: How can I handle the thrown error in such a way that it is not propagated to the console? I want to use a try - catch mechanism, not sure how that works in javascript ...
1 answers

You cannot use try catch, because the callstack that invokes the server request is not the callstack that receives the response (in other words, server requests are asynchronous).

You can receive errors by assigning a function to the "error" property of your arguments map, as you did for "callback". If everything is OK, callback will be invoked, otherwise, error will be invoked. But you will still see errounous netwerk requests in your log and stacktraces in your servers log.

So a much better approach is to pass the xpath string to the runtime and invoke a microflow that invokes a java action that executes the xpath and try-catch that. The Core exposes both synchronous and asynchronous API's to query data, and, above all, by catching your exceptions server side, you will not spam your log with exceptions.