MarkLogic Server 11.0 Product Documentation
cpf.failure

cpf.failure(
   docid as String,
   transition as element(*, p.transition)?,
   exception as Node?,
   override-state as String?
) as null

Summary

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.

Parameters
docid The URI of the document.
transition The pipeline transition being executed.
exception The exception leading to the processing failure, if any.

See usage notes for more information.

override-state The next state of the document, overriding the transition state.

Usage Notes

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.

Example

const cpf = require('/MarkLogic/cpf/cpf');

  declareUpdate();
  cpf.failure('/myDocs/example.xml', cpf.transition, null, null);

   
Powered by MarkLogic Server | Terms of Use | Privacy Policy