akamsteeg / AtleX.HaveIBeenPwned

A fully async .NET Standard client library for the API of HaveIBeenPwned.com
https://www.nuget.org/packages/AtleX.HaveIBeenPwned/
MIT License
5 stars 0 forks source link

In RateLimitExceededException, when the value of retry-after is less than 0 we should default to 0 instead of throwing an exception #73

Closed akamsteeg closed 1 year ago

akamsteeg commented 1 year ago

Currently, when the value of retryAfter in RateLimitExceededException is less than 0 an ArgumentOutOfRangeException is thrown.

https://github.com/akamsteeg/AtleX.HaveIBeenPwned/blob/d23072b9aa1de60a6d60b9a334f3ca07d8625dfb/src/AtleX.HaveIBeenPwned/RateLimitExceededException.cs#L30

However, that forces a user to implement an exception handler and write additional code to handle the exception. And what most likely will happen is that in the catch of the try..catch the request will be retried anyway. So, to make life easier we should just default to 0 when the specified retry-after is less than 0.