Skip to content

Latest commit

 

History

History
44 lines (36 loc) · 1010 Bytes

quiet.md

File metadata and controls

44 lines (36 loc) · 1010 Bytes

Function

quiet — quiet "missing" errors

Synopsis

quiet(val: any) -> any

Description

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.

Examples

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}