Merge "libexpr: improve error reporting if NIX_PATH item cannot be downloaded" into main
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
---
|
||||
synopsis: Show error when item from NIX_PATH cannot be downloaded
|
||||
issues: []
|
||||
cls: []
|
||||
category: Fixes
|
||||
credits: [ma27]
|
||||
---
|
||||
|
||||
For e.g. `nix-instantiate -I https://example.com/404`, you'd only get a warning if the download failed, such as
|
||||
|
||||
warning: Nix search path entry 'https://example.com/404' cannot be downloaded, ignoring
|
||||
|
||||
Now, the full error that caused the download failure is displayed with a note that the search
|
||||
path entry is ignored, e.g.
|
||||
|
||||
warning:
|
||||
… while downloading https://example.com/404 to satisfy NIX_PATH lookup, ignoring search path entry
|
||||
|
||||
warning: unable to download 'https://example.com/404': HTTP error 404 ()
|
||||
|
||||
response body: […]
|
||||
+3
-3
@@ -2,6 +2,7 @@
|
||||
#include "lix/libexpr/eval-settings.hh"
|
||||
#include "lix/libutil/archive.hh"
|
||||
#include "lix/libutil/async.hh"
|
||||
#include "lix/libutil/error.hh"
|
||||
#include "lix/libutil/hash.hh"
|
||||
#include "lix/libexpr/primops.hh"
|
||||
#include "lix/libexpr/print-options.hh"
|
||||
@@ -2827,9 +2828,8 @@ try {
|
||||
store, EvalSettings::resolvePseudoUrl(value), "source", false)).tree.storePath;
|
||||
res = { store->toRealPath(storePath) };
|
||||
} catch (FileTransferError & e) {
|
||||
logWarning({
|
||||
.msg = HintFmt("Nix search path entry '%1%' cannot be downloaded, ignoring", value)
|
||||
});
|
||||
e.addTrace(nullptr, "while downloading %s to satisfy NIX_PATH lookup, ignoring search path entry", value);
|
||||
logWarning(e.info());
|
||||
res = std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user