[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: better error messages through assertions
From: |
Maxim Cournoyer |
Subject: |
Re: better error messages through assertions |
Date: |
Mon, 28 Feb 2022 11:00:58 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) |
Hello,
Ludovic Courtès <ludo@gnu.org> writes:
> Ricardo Wurmus <rekado@elephly.net> skribis:
>
>> Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:
>>
>>> I hear we now have "field sanitizers" on Guix records; without having
>>> dug the details, it seems to be we could add a predicate validating the
>>> input there?
>>
>> I don’t see how that would help here. In my example the service values
>> themselves are all right. It’s a procedure acting on what it assumes is
>> a list of service values that fails.
>>
>> Record field validation would not have prevented that error.
>
> I think we could validate primarily at the user/core boundary. If the
> ‘services’ field had a sanitizer ensuring it’s a list of services, then
> it’d be fine.
That seems a fine approach to me; thank you for your input. Ricardo,
would you like to give idea a shot and see if it suites the bill? :-).
Maxim