Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Exception handling



On Feb 11,  2:45pm, Peter Stephenson wrote:
}
} I wrote the following test, with descriptions of what's going on.  If
} it's interesting I can add bits to the archive.

It's interesting ... just two comments:

}   # Raise an error, but don't show an error message.
}   # This is a bit of a hack.  (Surprised?)
}   { ${*ERROR*} } 2>/dev/null

How about something a little neater, like { ${:?THROW} } instead?  The
problem with relying on invalid syntax is that it might become valid
later.  (Like "{ foo } always { bar }" did, for example.)

} # grrr.... if this is rerun, catch mustn't be an alias when we define
} # it as a function...
} unalias catch 2>/dev/null

If you used "function catch { ... }" you wouldn't need the unalias, but
if you need unalias you probably need "builtin unalias".



Messages sorted by: Reverse Date, Date, Thread, Author