Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refer to DateTimeComponents field names in errors for null values #472

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dkhalanskyjb
Copy link
Collaborator

Fixes #471

@dkhalanskyjb dkhalanskyjb requested a review from ilya-g January 8, 2025 10:56
if (i != index) fields[i].set(this)
}
}
fail("No error if the field ${fields[index].property.name} is unset")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test pattern is usually covered with assertFailsWith<ExceptionType>

PropertyAndItsValue(DateTimeComponents::nanosecond, 123_456_789),
PropertyAndItsValue(DateTimeComponents::offsetHours, 3),
PropertyAndItsValue(DateTimeComponents::offsetMinutesOfHour, 30),
PropertyAndItsValue(DateTimeComponents::offsetSecondsOfMinute, 15),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is offsetIsNegative false by default?
Or null in offsetIsNegative is equivalent to false when formatting?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or null in offsetIsNegative is equivalent to false when formatting?

This one. We haven't explicitly designed this behavior, so we can discuss it if you think it's problematic.

@dkhalanskyjb dkhalanskyjb force-pushed the better-error-messages-on-DateTimeComponents-formatting branch from dfb061a to 553349f Compare February 10, 2025 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Obscure error message in the formatting API
2 participants