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

GetSeason returning JikanValidationException for year bigger than current year #24

Closed
JaoHundred opened this issue Dec 14, 2020 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@JaoHundred
Copy link

Hi Ervie, I've noticed GetSeason stopped working as expected, I'm not sure when this happened but the last version of jikan GetSeason returns JikanValidationException when selected year is bigger than current year.

Steps to reproduce:

  • Pass any year > current year to GetSeason

Expected:

  • GetSeason returned data for future seasons if it exists

Actual behavior:

  • GetSeason gives JikanValidationException at JikanDotNet.Helpers.Guard.IsValid[T] (System.Func`2[T,TResult] isValidFunc, T arg, System.String argumentName, System.String message) [0x00020] in :0
    at JikanDotNet.Jikan.GetSeason (System.Int32 year, JikanDotNet.Seasons season) [0x0001d] in
@Ervie
Copy link
Owner

Ervie commented Dec 14, 2020

You're correct. I added some validation of input parameters to prevent sending http request that were going to throw exception anyway (like negative mal id etc.). I just checked various scenarios for seasons and it turned out that request with year from 1000 to 9999 are correct (just returning empty collection of animes). Everything up to 999 and above 10000 will return 400 Bad Request, so I will just extend the range.

Otherwise ValidationException should be thrown to keep "fail fast" approach. Will release next version soon and ntify you.

@Ervie Ervie self-assigned this Dec 14, 2020
@Ervie Ervie added invalid This doesn't seem right bug Something isn't working and removed invalid This doesn't seem right labels Dec 14, 2020
@Ervie
Copy link
Owner

Ervie commented Dec 14, 2020

Done, version 1.5.4 should appear shortly. Remember that year lower than 1000 or bigger than 9999 will still fail.

@JaoHundred
Copy link
Author

Thanks again.

@Ervie Ervie closed this as completed Dec 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants