Last week I was hunting a production issue at work related to CppNix and the only hint I had was this warning. While the cause was clearly a CppNix issue since it was related to the libgit2-backed tarball cache, the fact that this exception was hidden, made it way harder to discover this. It would've saved me a lot of time[1] if the error was just printed out (and thus would've ended up in the logs). This is what this patch results in: $ nix-instantiate -I https://notexisting.com --find-file . --option connect-timeout 1 warning: error: unable to download 'https://notexisting.com': Resolving timed out after 1001 milliseconds (curl error code=28); retrying in 265 ms warning: error: unable to download 'https://notexisting.com/': Connection timed out after 1002 milliseconds (curl error code=28); retrying in 523 ms warning: error: unable to download 'https://notexisting.com/': Connection timed out after 1001 milliseconds (curl error code=28); retrying in 1324 ms warning: error: unable to download 'https://notexisting.com/': Connection timed out after 1000 milliseconds (curl error code=28); retrying in 2670 ms warning: … while downloading https://notexisting.com to satisfy NIX_PATH lookup (ignoring) warning: unable to download 'https://notexisting.com/': Connection timed out after 1001 milliseconds (curl error code=28) /path/to/nix/path/root The `unable to download` part was hidden before. Granted, this is not the most interesting showcase given the retries before, but I'd still argue that this is useful for cases where you don't have a connection timeout (and this was just the most trivial way to test for me). [1] Unlucky as I was, I had to mount an older backup and nixos-enter into the mount to reproduce this. Change-Id: If2894369fc0b159a307b448e1ce7d9b54a327df6
692 B
692 B
synopsis, issues, cls, category, credits
| synopsis | issues | cls | category | credits | |
|---|---|---|---|---|---|
| Show error when item from NIX_PATH cannot be downloaded | Fixes |
|
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: […]