quiet — quiet "missing" errors
quiet(val: any) -> any
The quiet function returns its argument val
unless val
is
error("missing")
, in which case it returns error("quiet")
.
Various operators and functions treat quiet errors differently than
missing errors, in particular, dropping them instead of propagating them.
Quiet errors are ignored by operators cut
, summarize
, and yield
.
Yield processes a quiet error and thus no output:
echo 'error("missing")' | super -z -c 'yield quiet(this)' -
=>
Without quiet, yield produces the missing error:
echo 'error("missing")' | super -z -c 'yield this' -
=>
error("missing")
The cut
operator drops quiet errors but retains missing errors:
echo '{a:1}' | super -z -c 'cut b:=x+1,c:=quiet(x+1),d:=quiet(a+1)' -
=>
{b:error("missing"),d:2}