bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC] Logically composable variant of errexit


From: Dan Douglas
Subject: Re: [RFC] Logically composable variant of errexit
Date: Fri, 10 Oct 2014 01:38:42 -0500

I would still propose that a simple and powerful way to extend Bash with
exception handling would be to extend the ERR trap by passing it some metadata
about the type and location of the exception incurred so that it can be handled
by user code. This proposal allows us to largely avoid having to answer the
question of "when and where does it make sense for this to get triggered?" for
the user.

It might require a new type of trap that just fires on anything that returns
false or fails so that the user handler can choose what to do about it in
various contexts.

A more ambitious proposal might be to try cloning zsh's try/catch. It would be
familiar to programmers and of course having a pre-existing implementation is a
plus. try/catch is probably more intrusive than my first proposal due to the
additional keywords and control flow changes.

-- 
Dan Douglas



reply via email to

[Prev in Thread] Current Thread [Next in Thread]