GNU bug report logs -
#49671
[PATCH] guix: records: Improve error reporting.
Previous Next
Full log
Message #11 received at 49671 <at> debbugs.gnu.org (full text, mbox):
Hello!
Julien Lepiller <julien <at> lepiller.eu> skribis:
> 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.
I like the idea!
I would prefer for error messages to be plain errors, without hints, so:
test.scm:2:2: error: (services 1 2 3): multiple values in field specifier
(Not a sentence, no period.)
But I’d also like to have hints, and ideally all hints should be
reported consistently, via ‘&fix-hint’ or similar.
Thankfully, we can do that via (guix diagnostics) + SRFI-35/34:
(raise (condition
(&syntax (form 'x) (subform 'y))
(&fix-hint (hint "Consider fixing this."))))
‘call-with-error-handling’ in (guix ui) might need to be adjusted.
The only downside is that (guix records) would now depend on another
Guix modules, which I tried to avoid so far so it could be more easily
reused elsewhere. But that’s the price to pay to get consistent error
reports, and I think it’s okay.
Note that ‘tests/guix-system.sh’ and a couple of other files test exact
error reports, so we’ll have to make sure it still works and possibly
augment the tests.
WDYT?
Thanks,
Ludo’.
This bug report was last modified 2 years and 334 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.