[Nix-dev] Re: Proposal: tryCatch function

Ludovic Courtès ludo at gnu.org
Tue Jan 6 01:15:09 CET 2009


Hello,

"Nicolas Pierron"
<nicolas.b.pierron at gmail.com> writes:

> Many people have reported that message are not very helpful and this
> is really the case inside NixOS where everything is merged and you are
> not able to figure out what is the problem.  So I have made a patch
> for nix which add a builtin called "tryCatch".  The tryCatch function
> expect a value and a function which expect one string argument.

That seems to do the job, but I don't like the name: why not just `try'
or `catch'?

Another concern is that it catches all exceptions.  Compare this with
what other languages typically provide, where only exceptions of the
specified type are caught (it's also usually possible to catch
exceptions of any type, e.g., by specifying `Exception' as the exception
type in Java, but that has to be made explicit.)

Thanks,
Ludo'.




More information about the nix-dev mailing list