Skip to content

Commit b259db9

Browse files
committed
Finish description of CredentialError
1 parent b248a42 commit b259db9

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

packages/credential-provider-base/__tests__/fromCredentials.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ describe("fromCredentials", () => {
55
it("should convert credentials into a credential provider", async () => {
66
const credentials: Credentials = {
77
accessKeyId: "foo",
8-
secretAccessKey: "bar"
8+
secretAccessKey: "bar",
9+
sessionToken: "baz",
10+
expiration: Math.floor(Date.now().valueOf() / 1000)
911
};
1012
const provider: CredentialProvider = fromCredentials(credentials);
1113

packages/credential-provider-base/lib/CredentialError.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1+
import { chain } from "./chain";
2+
13
/**
24
* An error representing a failure of an individual credential provider.
35
*
4-
* This error class has special meaning to
6+
* This error class has special meaning to the {@link chain} method. If a
7+
* provider in the chain is rejected with an error, the chain will only proceed
8+
* to the next provider if the value of the `tryNextLink` property on the error
9+
* is truthy. This allows individual providers to halt the chain and also
10+
* ensures the chain will stop if an entirely unexpected error is encountered.
511
*/
612
export class CredentialError extends Error {
713
constructor(message: string, public readonly tryNextLink: boolean = true) {

0 commit comments

Comments
 (0)