On Sat, Jan 3, 2009 at 11:39, Michael Raskin <[email protected]> wrote: > Nicolas Pierron wrote: >> 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}");
Ok: tryRethrow = try: edit: tryCatch try (msg: throw (edit msg)); > 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). Your are right, I've submitted this proposal without looking much at the drawbacks. Here is the list: - throw only throw strings and not any nix expression. (improvement) - the position of the first throw is lost. - ..? In fact, I don't see much drawback. > So I vote for reducing functionality to force > rethinking implementation if a need arises. What do you mean ? I have made this because I need this trick to handle error messages inside NixOS. I think this feature is general, very small and provide separation of concerns like somebody told me in an other post (why is there a name argument to the merge function ?). -- Nicolas Pierron http://www.linkedin.com/in/nicolasbpierron - If you are doing something twice then you should try to do it once. _______________________________________________ nix-dev mailing list [email protected] https://mail.cs.uu.nl/mailman/listinfo/nix-dev
