Skip to main content
Version: Next

has_error

Function

has_error test if a value is or contains an error

Synopsis

has_error(val: any) -> bool

Description

The has_error function returns true if its argument is or contains an error. has_error is different from is_error in that has_error will recurse into value's leaves to determine if there is an error in the value.

Examples

echo '{a:{b:"foo"}}' | zq -z 'yield has_error(this)' -
echo '{a:{b:"foo"}}' | zq -z 'a.x := a.y + 1 | yield has_error(this)' -

=>

false
true