emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#50982: closed ([PATCH] scripts: home/system: Don’t throw an error if


From: GNU bug Tracking System
Subject: bug#50982: closed ([PATCH] scripts: home/system: Don’t throw an error if no generations exist.)
Date: Thu, 06 Jan 2022 10:29:02 +0000

Your message dated Thu, 06 Jan 2022 11:28:22 +0100
with message-id <877dbdf9a1.fsf_-_@gnu.org>
and subject line Re: bug#50982: [PATCH] scripts: home/system: Don’t throw an 
error if no generations exist.
has caused the debbugs.gnu.org bug report #50982,
regarding [PATCH] scripts: home/system: Don’t throw an error if no generations 
exist.
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
50982: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=50982
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: [PATCH] scripts: home/system: Don’t throw an error if no generations exist. Date: Sat, 02 Oct 2021 23:05:48 +0200
Previously, When running ‘guix home describe’ or ‘guix system describe’ prior
to having any generations, a backtrace would produced.  Since not having any
existing generations is not an error, a warning would be enough.

  $ guix system describe
  guix system: warning: no system generation, nothing to describe

* guix/scripts/home.scm (process-command): Produce a warning instead of an
error if no generations exist.
* guix/scripts/system.scm (process-command): Likewise.

Fixes: <https://issues.guix.gnu.org/50978>
Reported-by: Maxime Devos <maximedevos@telenet.be>
---
 guix/scripts/home.scm   | 2 +-
 guix/scripts/system.scm | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/guix/scripts/home.scm b/guix/scripts/home.scm
index 75df6d707d..70860564eb 100644
--- a/guix/scripts/home.scm
+++ b/guix/scripts/home.scm
@@ -260,7 +260,7 @@ (define-syntax-rule (with-store* store exp ...)
     ((describe)
      (match (generation-number %guix-home)
        (0
-        (error (G_ "no home environment generation, nothing to describe~%")))
+        (warning (G_ "no home environment generation, nothing to describe~%")))
        (generation
         (display-home-environment-generation generation))))
     ((list-generations)
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 65eb98e4b2..d77d3ea289 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -1307,7 +1307,7 @@ (define-syntax-rule (with-store* store exp ...)
     ((describe)
      (match (generation-number %system-profile)
        (0
-        (error (G_ "no system generation, nothing to describe~%")))
+        (warning (G_ "no system generation, nothing to describe~%")))
        (generation
         (display-system-generation generation))))
     ((search)

base-commit: f1a3c11407b52004e523ec5de20d326c5661681f
-- 
2.33.0






--- End Message ---
--- Begin Message --- Subject: Re: bug#50982: [PATCH] scripts: home/system: Don’t throw an error if no generations exist. Date: Thu, 06 Jan 2022 11:28:22 +0100 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Maxime Devos <maximedevos@telenet.be> skribis:

> Xinglu Chen schreef op za 02-10-2021 om 23:05 [+0200]:
>> Previously, When running ‘guix home describe’ or ‘guix system describe’ prior
>> to having any generations, a backtrace would produced.  Since not having any
>> existing generations is not an error, a warning would be enough.
>> 
>>   $ guix system describe
>>   guix system: warning: no system generation, nothing to describe
>
> Printing a warning instead of an error to avoid a backrace isn't necessary.
> E.g., "guix show i-do-not-exists" prints an error
> ‘guix show: error: i-do-not-exist: package not found’.
>
> I suggest using (leave (G_ "bla bla")) instead of (error (G_ "bla bla"))
> for these kind of errors, it appears to work '%find-package' in (gnu 
> packages).

I’ve done that now, thanks!

Ludo’.


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]