Skip to content

Commit

Permalink
interp: Make empty _finally fin error on error
Browse files Browse the repository at this point in the history
Ex: _finally(error(a); empty)
This is not used by fq atm
  • Loading branch information
wader committed Jun 17, 2022
1 parent 13ce14d commit 81a014c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/interp/internal.jq
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,19 @@ def _slurps(f): _global_var("slurps"; f);
# call f and finally eval fin even if empty or error.
# _finally(1; debug)
# _finally(null; debug)
# _finally(error("a"); debug)
# _finally(empty; debug)
# _finally(1,2,3; debug)
# _finally({a:1}; debug)
# _finally(error("a"); debug)
# _finally(error("a"); empty)
def _finally(f; fin):
try
( f
, (fin | empty)
)
catch
( fin as $_
| error
( (fin | empty)
, error
);

# TODO: figure out a saner way to force int
Expand Down

0 comments on commit 81a014c

Please sign in to comment.