Because this uses string interpolation it's somewhat expensive. But many times, this exception is handled automatically with for example Polly. A RateLimitExceededException is thrown, catched and after the timeout specified in the RetryAfter property has elapsed the request is retried. The message is rarely inspected in those cases. Running the string formatting and allocating a string that in many cases isn't used has a performance impact.
In
RateLimitExceededException
, the exception message is created once it's thrown:https://github.com/akamsteeg/AtleX.HaveIBeenPwned/blob/f2ba52019d9a5adfca231a529d7ab731c832d127/src/AtleX.HaveIBeenPwned/RateLimitExceededException.cs#L28-L29
Because this uses string interpolation it's somewhat expensive. But many times, this exception is handled automatically with for example Polly. A
RateLimitExceededException
is thrown, catched and after the timeout specified in theRetryAfter
property has elapsed the request is retried. The message is rarely inspected in those cases. Running the string formatting and allocating a string that in many cases isn't used has a performance impact.