fn.error( [error as xs.QName?], [description as String], [data as Sequence] ) as null
[1.0 and 1.0-ml only, 0.9-ml has a different signature] Throw the given error. When an error is thrown, the XQuery program execution is stopped. For detailed semantics, see http://www.w3.org/TR/xpath-functions/#func-error.
Parameters | |
---|---|
error |
Error code, as an xs:QName . Note that this parameter does not
exist in 0.9-ml.
|
description | String description to be printed with the error. |
data | Parameters to the error message. |
var x = xdmp.random(100); var res = new Array(); if ( x > 50 ) { fn.error(xs.QName("ERROR"), "greater than 50") } else { res.push("Less than or equal to 50") }; res.push(": no error was thrown"); fn.concat(res[0], res[1]); => The error when the random number is greater than 50, otherwise a string.
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.