robwhitby/xray — pull request #11 by mblakele (2012-09-15 20:38:17+00:00)
Title: When working with exception XML, use error code not error name

There's room for some argument here, but I think the emphasis on the `error:name` element is at odds with the way the server itself uses the error schema. Take a look at the exception thrown by a built-in function:

try { cts:search('', ()) } catch ($ex) { $ex }

XDMP-UNSEARCHABLE

1.0-ml
Expression is unsearchable
XDMP-UNSEARCHABLE: cts:search("", cts:and-query((), ())) -- Expression is unsearchable
...

The `XDMP-UNSEARCHABLE` bit is the code, not the name. The way to generate this with `fn:error` is to leave arg1 empty, put the code in arg2, and put anything else into arg3. The error handling in cq and qconsole uses a similar convention.