From 89865da76d87292e5bc61f324b1ac892d40236e7 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 1 Jun 2010 11:19:32 +0000 Subject: [PATCH] * Turn build errors during evaluation into EvalErrors. --- src/libexpr/nixexpr.hh | 1 + src/libexpr/primops.cc | 6 +++++- src/libstore/build.cc | 2 +- src/libstore/store-api.hh | 2 -- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/libexpr/nixexpr.hh b/src/libexpr/nixexpr.hh index 1c72441b2..b1043a326 100644 --- a/src/libexpr/nixexpr.hh +++ b/src/libexpr/nixexpr.hh @@ -15,6 +15,7 @@ MakeError(AssertionError, EvalError) MakeError(ThrownError, AssertionError) MakeError(Abort, EvalError) MakeError(TypeError, EvalError) +MakeError(ImportError, EvalError) // error building an imported derivation /* Position objects. */ diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 9d36fb6a0..42c858611 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -37,7 +37,11 @@ static void prim_import(EvalState & state, Value * * args, Value & v) throw EvalError(format("cannot import `%1%', since path `%2%' is not valid") % path % *i); if (isDerivation(*i)) - store->buildDerivations(singleton(*i)); + try { + store->buildDerivations(singleton(*i)); + } catch (Error & e) { + throw ImportError(e.msg()); + } } state.evalFile(path, v); diff --git a/src/libstore/build.cc b/src/libstore/build.cc index 412640670..f901c1f7d 100644 --- a/src/libstore/build.cc +++ b/src/libstore/build.cc @@ -267,7 +267,7 @@ public: MakeError(SubstError, Error) -MakeError(BuildError, Error) /* denoted a permanent build failure */ +MakeError(BuildError, Error) /* denotes a permanent build failure */ ////////////////////////////////////////////////////////////////////// diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh index 8506d47e3..0590f448c 100644 --- a/src/libstore/store-api.hh +++ b/src/libstore/store-api.hh @@ -16,8 +16,6 @@ namespace nix { typedef std::map Roots; - - struct GCOptions { /* Garbage collector operation: