Closed
Description
openedon Apr 6, 2021
While both errors CredentialUnavailableError from AuthenticationRequiredError can be used in the same scenario, the one of skipping ChainedTokenCredential, the way to assert for errors in JavaScript is through the error names, which we overwrite regardless of the inheritance (the child class gets to have its own name only, not the parent name). So, if it's only for the name, which is the current use case of both errors, the inheritance is unnecessary.
Also, add this on the ChainedTokenCredential, and add a test:
- if (err.name === "CredentialUnavailableError") {
+ if (err.name === "CredentialUnavailableError" || err.name === "AuthenticationRequiredError") {
Also add a test.
From: #14690 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment