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

Throw InvalidApiKeyException instead of InvalidOperationException when no API key is supplied #34

Closed akamsteeg closed 4 years ago

akamsteeg commented 4 years ago

In HaveIBeenPwnedClient.GetAuthenticatedAsync<T>(Uri, CancellationToken) we throw an InvalidOperationException when no API key is supplied via the HaveIBeenPwnedClientSettings:

https://github.com/akamsteeg/AtleX.HaveIBeenPwned/blob/20215cc1c9904dd113973182f65cfaa55fc02df8/src/AtleX.HaveIBeenPwned/HaveIBeenPwnedClient.cs#L465

However, in #28 we introduced the InvalidApiKeyException and that's thrown when the supplied API key is invalid or expired. We should also throw this when no API key is is supplied via the settings.