cpf.failure( docid as String, transition as element(*, p.transition)?, exception as Node?, override-state as String? ) as null
Concludes the state action in failure, advancing the state as defined by the
state transition. The state action must call this method to indicate
failure, passing the external variables
cpf.documentUri
,
cpf.transition
,
and
cpf.exception
as parameters.
If the document does not exist, do nothing.
Side effects: Advances the document state to the transition's on-failure state, if any, and marks the document as processed in the current state.
The exception
parameter must be an XML error
element node in the namespace "http://marklogic.com/xdmp/error". Since exceptions in Server-Side JavaScript are generally expressed as JavaScript objects, you should not pass a non-null value in for the exception
parameter. If you want to capture information about the failure, your code should log it explicitly, rather than relying on this function.
const cpf = require('/MarkLogic/cpf/cpf'); declareUpdate(); cpf.failure('/myDocs/example.xml', cpf.transition, null, null);