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

Add suppressions for Roslynator warning RCS1194 #69

Closed akamsteeg closed 2 years ago

akamsteeg commented 2 years ago

In ApiKeyException and RateLimitExceededException we get a RCS1194 warning from Roslynator. We're not implementing the default exception constructors there and Roslynator warns us about that. However, we don't override the exception constructors for good reason so we need to add supression rules for the warning to those exceptions.

  1. In ApiKeyException we really don't want to leak API keys to logging systems or end users or whatever. So we disable using a constructor override with a custom message.
  2. The RateLimitExceededException already gives all the information a user of the library needs. This exception is mainly meant to be handled in application code to pause and then retry when the specified timeout (available in the RetryAfter property) has elapsed., There's no real need to override the exception message here. And more importantly. implementing the default constructors can result in not setting the RetryAfter property leading it to be a TimeSpan of zero while that's incorrect.