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

isValidTimetableDateTime should provide a more precise assertion error #127

Closed
raLaaaa opened this issue Aug 7, 2022 · 3 comments
Closed
Assignees
Labels
T: Feat Type: :tada: New Features

Comments

@raLaaaa
Copy link
Contributor

raLaaaa commented Aug 7, 2022

During development one could encounter having a date with is an invalid time table date.
I think that an date is none UTC conform is probably the most likely reason. But it could also be null.
Asserting the value at various points with isValidTimetableDateTime is a great way to ensure this does not happen during development how ever if this happens the developer can not be certain for what reason it is not since there is no specific assertion message attached.

I took a look at the code and I'm not quite sure if this is an easy fix due to the nature of assertions nor am I quite sure if this is really something the library should do for the developer. Hinting him to the assertion error(s) quite does the task.

How ever it would be quite convenient when you believe you are searching for null values in your code but the date is simply UTC formatted.

What do you think?

@raLaaaa raLaaaa added the T: Feat Type: :tada: New Features label Aug 7, 2022
@JonasWanke
Copy link
Owner

dateTime.isValidTimetableDateTime only checks that the DateTime has isUtc set. For nullable DateTimes, null is also allowed. This is true for all isValidTimetable… checks.

I can add a message (or, maybe, use FlutterError) to this and other checks to make clearer what is expected of these values, similar to the note in the README.

@raLaaaa
Copy link
Contributor Author

raLaaaa commented Aug 7, 2022

I don't think this has high priority. This is more a convenience point but I still believe that it might be helpful. I might help you out if you are interested. Adding an optional error message to assertions should be pretty straight forward.

@JonasWanke JonasWanke self-assigned this Aug 16, 2022
@JonasWanke
Copy link
Owner

JonasWanke commented Aug 19, 2022

I've added detailed error messages (using FlutterError) as part of v1.0.0-alpha.9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: Feat Type: :tada: New Features
Projects
None yet
Development

No branches or pull requests

2 participants