GNU bug report logs - #49671
[PATCH] guix: records: Improve error reporting.

Previous Next

Package: guix-patches;

Reported by: Julien Lepiller <julien <at> lepiller.eu>

Date: Tue, 20 Jul 2021 23:42:02 UTC

Severity: normal

Tags: patch

Full log


View this message in rfc822 format

From: Julien Lepiller <julien <at> lepiller.eu>
To: 49671 <at> debbugs.gnu.org
Subject: [bug#49671] [PATCH] guix: records: Improve error reporting.
Date: Wed, 21 Jul 2021 01:40:47 +0200
[Message part 1 (text/plain, inline)]
Hi Guix!

This patch improves error reporting a bit when making mistakes in guix
records. This is motivated by a user getting "invalid field specifier"
for their whole services field in their os record. With this patches,
they would have seen:

multiple values in field specifier. Got 2 values associated with key
services. Values are:
(append (list (service ...) ...))
(modify-services %desktop-services ...)

Which would have hinted them at fixing the parenthesis. Or at least, it
would have saved us some time trying to count them :)

Here are the cases that are handled and the associated message:

(operating-system
  services)
guix system: error: services: invalid field specifier. The format of a
field is `(services value)'

(operating-system
  (services))
test.scm:2:2: error: (services): Value missing in field specifier. The
format of a field is `(services value)'.

(operating-system
  (services 1 2 3))
test.scm:2:2: error: (services 1 2 3): multiple values in field
specifier. Got 3 values associated with key services. Values are:
1
2
3

(operating-system
  ())
guix system: error: (): invalid field specifier. The format of a field
is `(field value)'

(operating-system
  ((services %desktop-services)))
test.scm:2:2: error: ((services %desktop-services)): invalid field
specifier. (services %desktop-services) is not a valid field name.


Of course, we can improve these error messages, and internationalize
them.

WDYT?
[0001-guix-records-Improve-error-reporting.patch (text/x-patch, attachment)]

This bug report was last modified 2 years and 333 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.