assert

SpecialNodes assert

input ports:
Name Type Description Optional

input

?0

value interpreted as boolean

no

assert throws a runtime error, which causes program termination and a backtrace to stderr, if its input value is false. Use this only when you want the process that is running it to stop (terminate) on failure of the assertion. If this is not the behavior you want, but you simply want to detect when a condition is false, use something like this instead:

SpecialNodes assert2

The blue (typed) wire entering the not node is the condition that should be true. The not inverts the sense so that a log message will be produced when the condition is false. echoif echoes all its data inputs to the corresponding outputs if its first input is true. The second input to echoif is connected to the output of the not merely as a convenient way of assigning a type to the data input / data output of the echoif node. One could alternatively select and set the type of the link from echoif to log. Running this example with a false value entering the not gives:

SpecialNodes assert2

The log message goes to stderr because that’s where log sends its output.