[Nix-dev] Re: tryCatch function: tryRethow ?

Michael Raskin 7c6f434c at mail.ru
Sat Jan 3 11:39:39 CET 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Nicolas Pierron wrote:
> Hi,
> 
> 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.
> 
> |   v1 = builtins.throw "v1: throw message";
> |   v2 = tryCatch v1 (msg: builtins.throw "v2: ${msg}");

I would prefer having tryRethrow here.

v2 = tryRethrow v1 (msg: "v2: ${msg}");

In your proposal you only get the thrown message. All your arguments are
for reprocessing error messages. And it looks like a great tool for that
task. On the other hand, it provides something that can be used for
ad-hoc error handling and online substitution of alternative dependency
packages. It looks like you haven't analyzed the benefits and drawbacks
of your syntax solution for that task (and if you have, you don't give
us your findings). So I vote for reducing functionality to force
rethinking implementation if a need arises.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQEcBAEBAgAGBQJJX0BpAAoJEE6tnN0aWvw3zIUIAINxJjorrRL2E7aGkTCjTvnk
iYMIG/pjoKONKq1BtalMB1EKhZ+2A/JhfXhxCGBTHv62mjjtwyDzjaMx9wD1IExg
IHzMzfnZXrbsnd4PrgyCSz8nxrKNkrQSJIMFiF7TlIXj2rSwkL2JJI++razL7eNm
fSDESJAWkHuA2W2Yj2gqlXdGz7qT78kgy30lD4QrlBU8ZnDhK6OLgJJe8hoUr+kN
jrP5PcntwSa9jYoasWoo1aXdiCol/7EeH34cgy4qHv7ZvgglgLtBHPltdTQnLKea
OEwzAa9HNGuxvLFreIdT9PEqIbCR4ULcGLKTiaOcbznxVDm6CGEzyN8yrd1cCbk=
=SZLR
-----END PGP SIGNATURE-----



More information about the nix-dev mailing list