icu4x icon indicating copy to clipboard operation
icu4x copied to clipboard

Align `DateError` with `DateFromFieldsError`

Open robertbastian opened this issue 2 months ago • 4 comments

#7010

Adds DateError::MonthCodeNotInCalendar, DateError::MonthCodeNotInYear, docs, and flattens DateFromFieldsError::Range

robertbastian avatar Oct 21 '25 12:10 robertbastian

As it stands this is a breaking change, yes?

Manishearth avatar Nov 10 '25 17:11 Manishearth

no

robertbastian avatar Nov 10 '25 22:11 robertbastian

Ah, I see, UnknownMonthCode is still around. There is a little bit of concern around splitting the error variants but I don't really think matching on these variants is that common.

I like this. I'm pretty ambivalent on the "nested RangeError or struct variant" thing, our design here has some mistakes but overall this is an extremely minor aspect of the API.

Manishearth avatar Nov 10 '25 22:11 Manishearth

I'm against adding new variants to DateError if it causes existing call sites with non-exhaustive matching on error variants to start falling into the catchall variant.

And my position on the nested RangeError hasn't changed since last discussed in #7010.

sffc avatar Nov 10 '25 23:11 sffc