diff options
author | Bob van der Linden <bobvanderlinden@gmail.com> | 2023-02-08 20:03:57 +0100 |
---|---|---|
committer | Bob van der Linden <bobvanderlinden@gmail.com> | 2023-02-27 21:39:34 +0100 |
commit | 3113b13df9afaab918792c725742c6bc3fcec88b (patch) | |
tree | a31a2fbd6157ca7005ca5472b632afcbe2ca5fe3 /src/libstore/builtins/buildenv.hh | |
parent | 707ba52f2d1855f2613da3a576488f5040843915 (diff) |
buildenv: throw BuildEnvFileConflictError with more context
At the moment an Error is thrown that only holds an error message
regarding `nix-env` and `nix profile`. These tools make use of
builtins.buildEnv, but buildEnv is also used in other places. These
places are unrelated to Nix profiles, so the error shouldn't mention
these tools.
This generic error is now BuildEnvFileConflictError, which holds more
contextual information about the files that were conflicting while
building the environment.
Diffstat (limited to 'src/libstore/builtins/buildenv.hh')
-rw-r--r-- | src/libstore/builtins/buildenv.hh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/libstore/builtins/buildenv.hh b/src/libstore/builtins/buildenv.hh index 73c0f5f7f..a018de3af 100644 --- a/src/libstore/builtins/buildenv.hh +++ b/src/libstore/builtins/buildenv.hh @@ -12,6 +12,32 @@ struct Package { Package(const Path & path, bool active, int priority) : path{path}, active{active}, priority{priority} {} }; +class BuildEnvFileConflictError : public Error +{ +public: + const Path fileA; + const Path fileB; + int priority; + + BuildEnvFileConflictError( + const Path fileA, + const Path fileB, + int priority + ) + : Error( + "Unable to build profile. There is a conflict for the following files:\n" + "\n" + " %1%\n" + " %2%", + fileA, + fileB + ) + , fileA(fileA) + , fileB(fileB) + , priority(priority) + {} +}; + typedef std::vector<Package> Packages; void buildProfile(const Path & out, Packages && pkgs); |