-
-
Notifications
You must be signed in to change notification settings - Fork 90
audit error messages for datetime parsing #519
Description
This input, 2022-04-04T26:00:00+00, used to produce this error message:
error: invalid value '2022-04-04T26:00:00+00' for '--exclude-newer <EXCLUDE_NEWER>': `2022-04-04T26:00:00+00` could not be parsed as a valid date: failed to parse hour in time: parsed hour is not valid: parameter 'hour' with value 26 is not in the required range of 0..=23
But now it produces:
error: invalid value '2022-04-04T26:00:00+00' for '--exclude-newer <EXCLUDE_NEWER>': `2022-04-04T26:00:00+00` could not be parsed as a valid date: failed to parse hour in time: failed to parse two digit integer as hour: parameter 'hour' is not in the required range of 0..=23
The new error message is a little worse. In particular, it's somewhat more repetitive and the invalid value, 26 in this case, isn't mentioned in the error message. The message does still call out the "hour" component, which I think should hopefully point users in the right direction. But arguably including the parsed value would be better.
I think at the very least we should try to remove some of the repetitiveness in the error message. I'm not sure if I'm going to add back the 26 reference (for example) because I've been slowly trying to slim down Jiff's error type to not carry as much data. This will invariably lead to slightly worse error messages in some cases.