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

Replace runtime ToManyStations error with compile time check #18

Merged
merged 6 commits into from Dec 8, 2022

Conversation

jontze
Copy link
Owner

@jontze jontze commented Dec 8, 2022

This change was done to prevent runtime errors if the user tried to fetch prices for more than 10 stations at once. Due to a limitation of the tankerkoenig API it's not possible to request more than 10 stations at once.

To ensure this behavior already at compile time, the fetch station prices function now accepts only an array with up to 10 entries instead a vector with unknown size.

This comes at costs to the usability, as you now have to wrap the ids in the array to options, but on the other side it is less likely to cause runtime errors.

@jontze jontze added the enhancement New feature or request label Dec 8, 2022
@jontze jontze added this to the v0.1.0 milestone Dec 8, 2022
@jontze jontze self-assigned this Dec 8, 2022
…heck

This change was done to prevent runtime errors if the user tried to
fetch prices for more than 10 stations at once. Due to a limitation of
the tankerkoenig API it's not possible to request more than 10 stations
at once.

To ensure this behaviour already at compile time, the fetch station
prices function now accepts only an array with up to 10 entries instead
a vector with unknown size.

This comes at costs to the usability, as you know have to wrap the ids
in the array to options, but on the other side it is less likely to
cause runtime errors.
@jontze jontze changed the title Replace runtme ToManyStations error with compile time check Replace runtime ToManyStations error with compile time check Dec 8, 2022
@jontze jontze enabled auto-merge December 8, 2022 11:06
@jontze jontze disabled auto-merge December 8, 2022 11:08
@jontze jontze enabled auto-merge December 8, 2022 11:08
@jontze jontze merged commit 575b9f1 into main Dec 8, 2022
@jontze jontze deleted the feat/station-list branch December 8, 2022 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant