From cb0edae277f5c4f895abb67174bd9dcbf9b4e58a Mon Sep 17 00:00:00 2001 From: figsoda Date: Sat, 25 Mar 2023 22:16:09 -0400 Subject: [PATCH] improve error message when no hash is found --- nix_update/update.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nix_update/update.py b/nix_update/update.py index 37a93df..edfe3ba 100644 --- a/nix_update/update.py +++ b/nix_update/update.py @@ -3,6 +3,7 @@ import re import shutil import subprocess +import sys import tempfile import tomllib from concurrent.futures import ThreadPoolExecutor @@ -90,6 +91,7 @@ def nix_prefetch(opts: Options, attr: str) -> str: extra_env: Dict[str, str] = {} tempdir: Optional[tempfile.TemporaryDirectory[str]] = None + stderr = "" if extra_env.get("XDG_RUNTIME_DIR") is None: tempdir = tempfile.TemporaryDirectory() extra_env["XDG_RUNTIME_DIR"] = tempdir.name @@ -117,7 +119,10 @@ def nix_prefetch(opts: Options, attr: str) -> str: tempdir.cleanup() if got == "": - raise UpdateError(f"empty hash when trying to update {opts.attribute}.{attr}") + print(stderr, file=sys.stderr) + raise UpdateError( + f"failed to retrieve hash when trying to update {opts.attribute}.{attr}" + ) else: return got