From c4cb6ea2bc77f1f9239ce81ffc7a0fa6b540b1ab Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 22 Jun 2004 08:50:25 +0000 Subject: * Refactoring. --- src/libstore/normalise.cc | 24 +++++------------------- src/libstore/store.cc | 3 ++- 2 files changed, 7 insertions(+), 20 deletions(-) (limited to 'src/libstore') diff --git a/src/libstore/normalise.cc b/src/libstore/normalise.cc index 937dbc7f9bac..29a6c339cb15 100644 --- a/src/libstore/normalise.cc +++ b/src/libstore/normalise.cc @@ -497,14 +497,8 @@ void NormalisationGoal::buildDone() /* Check the exit status. */ if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { deleteTmpDir(false); - if (WIFEXITED(status)) - throw Error(format("builder for `%1%' failed with exit code %2%") - % nePath % WEXITSTATUS(status)); - else if (WIFSIGNALED(status)) - throw Error(format("builder for `%1%' failed due to signal %2%") - % nePath % WTERMSIG(status)); - else - throw Error(format("builder for `%1%' failed died abnormally") % nePath); + throw Error(format("builder for `%1%' %2%") + % nePath % statusToString(status)); } deleteTmpDir(true); @@ -1425,17 +1419,9 @@ void SubstitutionGoal::finished() debug(format("substitute for `%1%' finished") % storePath); /* Check the exit status. */ - /* !!! cut & paste */ - if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { - if (WIFEXITED(status)) - throw Error(format("builder for `%1%' failed with exit code %2%") - % storePath % WEXITSTATUS(status)); - else if (WIFSIGNALED(status)) - throw Error(format("builder for `%1%' failed due to signal %2%") - % storePath % WTERMSIG(status)); - else - throw Error(format("builder for `%1%' failed died abnormally") % storePath); - } + if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) + throw Error(format("builder for `%1%' %2%") + % storePath % statusToString(status)); if (!pathExists(storePath)) throw Error(format("substitute did not produce path `%1%'") % storePath); diff --git a/src/libstore/store.cc b/src/libstore/store.cc index 73c09b27442f..59d4430fd692 100644 --- a/src/libstore/store.cc +++ b/src/libstore/store.cc @@ -164,7 +164,8 @@ void copyPath(const Path & src, const Path & dst) throw SysError("waiting for child"); if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) - throw Error("cannot copy file: child died"); + throw Error(format("cannot copy `%1% to `%2%': child %3%") + % src % dst % statusToString(status)); } -- cgit 1.4.1