Closed akamsteeg closed 1 year ago
We strive to only throw three basic exception types:
ArgumentException
ArgumentNullException
TaskCanceledException
OperationCanceledException
HaveIBeenPwnedClientException
InvalidApiKeyException
RateLimitExceededException
This makes handling exceptions for any users of the library quite easy.
Easy, at most three catches or of course just a single one if you don't care and want to go all Pokémon and catch them all.
catch
But, we directly throw an InvalidOperationException here:
InvalidOperationException
https://github.com/akamsteeg/AtleX.HaveIBeenPwned/blob/d23072b9aa1de60a6d60b9a334f3ca07d8625dfb/src/AtleX.HaveIBeenPwned/HaveIBeenPwnedClient.cs#L343-L346
That needs to change to a HaveIBeenPwnedClientException with possibly the InvalidOperationException wrapped in it.
We strive to only throw three basic exception types:
ArgumentException
(withArgumentNullException
and c.s.)TaskCanceledException
/OperationCanceledException
when the cancellation token indicates the operation should be canceledHaveIBeenPwnedClientException
for all internal exceptions includingInvalidApiKeyException
andRateLimitExceededException
This makes handling exceptions for any users of the library quite easy.
ArgumentException
OperationCanceledException
(TaskCanceledException
)HaveIBeenPwnedClientException
or a derivative.Easy, at most three
catch
es or of course just a single one if you don't care and want to go all Pokémon and catch them all.But, we directly throw an
InvalidOperationException
here:https://github.com/akamsteeg/AtleX.HaveIBeenPwned/blob/d23072b9aa1de60a6d60b9a334f3ca07d8625dfb/src/AtleX.HaveIBeenPwned/HaveIBeenPwnedClient.cs#L343-L346
That needs to change to a
HaveIBeenPwnedClientException
with possibly theInvalidOperationException
wrapped in it.