Skip to content

Assert

Halts the run when a runtime assertion fails.

@lainstack/flow/assert · Flow

Use this block to stop the work when a condition must hold. It does not branch. If the comparison matches, the run continues on out and the output is empty. If it does not match, the step fails with error code assertion_failed. The error is not retried.

  • Set failureMessage (1 to 500 characters) to say what was expected. Without it the error reads “Assertion failed: did not match.”
  • If an operand has no value, for example it refers to a block that did not run on this path, the step fails with comparison_invalid instead.
  • The comparison rules are the same as in @lainstack/flow/condition: text equality ignores letter case unless comparison.settings.matchCase is true.
  • To route on the result, use @lainstack/flow/condition. To ask a person, use @lainstack/flow/approval. To test many values and report all findings, use @lainstack/flow/checklist.
  • Inside @lainstack/flow/for-each-item, a failed assert fails that item. The loop errorPolicy then decides what happens next.
Setting Key Type Details
Value type comparison.kind One of Text, Number, Yes or no, Null, List, Record, Date, Date/time Default text.
Value comparison.left Text
Comparison comparison.operator One of Equals, Does not equal, Contains, Does not contain, Starts with, Ends with, Is empty, Is not empty, Greater than, Greater than or equal, Less than, Less than or equal, Is Yes, Is No, Is null, Is not null, Contains item, Does not contain item, Has field, Does not have field, Before, On or before, After, On or after
Compare with comparison.right Text
Failure message failureMessage Text