[Nix-dev] Proposal: tryCatch function

Eelco Dolstra e.dolstra at tudelft.nl
Tue Jan 6 12:07:05 CET 2009


Hi,

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.

Can you give some example use cases of where this would help?  "throw" already
takes a string argument, so the error message can be as helpful as you want it
to be.  If the "throw" error message cannot show a helpful message because it
lacks context (e.g. deep in some function call), the necessary context could be
passed in as a string argument, for instance.

-- 
Eelco Dolstra | http://www.st.ewi.tudelft.nl/~dolstra/



More information about the nix-dev mailing list