Closed jimmyjames closed 1 year ago
codecov failure due to fall-thru line not being covered. Since ExecutionException
is only thrown for checked exceptions, and JwkProvider#get()
only throws a JwkException
, the instance checking and fallback are a bit overly careful. The effort to test such a case does not seem worthwhile since it's not a realistic scenario and simple mocking will not work as the provider cannot throw anything other than a JwkException
.
Prior to this change, if using a cached JWK provider (the default), any exception caught when accessing the JWK would be a
SigningKeyNotFoundException
, with a cause ofExecutionException
(thrown by the cache provider).Since the cause of an exception may be for different reasons (e.g., network exception, KID not found), developers would need to unwrap the
SigningKeyNotFoundException
to get theExecutionException
, which itself would contain the specific reason for failure (someJwkException
).As raised in #165, this is cumbersome. Instead, this PR throws the causing exception directly, so that developers can more easily identify why the operation failed.
Fixes #165