guix-patches
[Top][All Lists]
Advanced

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

[bug#49671] [PATCH] guix: records: Improve error reporting.


From: Julien Lepiller
Subject: [bug#49671] [PATCH] guix: records: Improve error reporting.
Date: Wed, 21 Jul 2021 01:40:47 +0200

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?

Attachment: 0001-guix-records-Improve-error-reporting.patch
Description: Text Data


reply via email to

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