-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Improve shareability of error functions (#12048)
Co-authored-by: Aaron S <[email protected]>
- Loading branch information
Showing
44 changed files
with
359 additions
and
267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
packages/auth/src/providers/cognito/tokenProvider/errorHelpers.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { | ||
AmplifyErrorMap, | ||
AssertionFunction, | ||
createAssertionFunction, | ||
} from '@aws-amplify/core/internals/utils'; | ||
|
||
export enum TokenProviderErrorCode { | ||
InvalidAuthTokens = 'InvalidAuthTokens', | ||
} | ||
|
||
const tokenValidationErrorMap: AmplifyErrorMap<TokenProviderErrorCode> = { | ||
[TokenProviderErrorCode.InvalidAuthTokens]: { | ||
message: 'Invalid tokens.', | ||
recoverySuggestion: 'Make sure the tokens are valid.', | ||
}, | ||
}; | ||
|
||
export const assert: AssertionFunction<TokenProviderErrorCode> = | ||
createAssertionFunction(tokenValidationErrorMap); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { createAssertionFunction } from '../../errors'; | ||
import { AmplifyErrorMap, AssertionFunction } from '../../types'; | ||
|
||
export enum PinpointValidationErrorCode { | ||
NoAppId = 'NoAppId', | ||
} | ||
|
||
const pinpointValidationErrorMap: AmplifyErrorMap<PinpointValidationErrorCode> = | ||
{ | ||
[PinpointValidationErrorCode.NoAppId]: { | ||
message: 'Missing application id.', | ||
}, | ||
}; | ||
|
||
export const assert: AssertionFunction<PinpointValidationErrorCode> = | ||
createAssertionFunction(pinpointValidationErrorMap); |
Oops, something went wrong.