mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 22:27:22 +00:00
misc: scoped down to AWS-related errors
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
import { KMSServiceException } from "@aws-sdk/client-kms";
|
||||||
|
import { STSServiceException } from "@aws-sdk/client-sts";
|
||||||
import { ForbiddenError } from "@casl/ability";
|
import { ForbiddenError } from "@casl/ability";
|
||||||
import slugify from "@sindresorhus/slugify";
|
import slugify from "@sindresorhus/slugify";
|
||||||
|
|
||||||
@@ -71,10 +73,14 @@ export const externalKmsServiceFactory = ({
|
|||||||
switch (provider.type) {
|
switch (provider.type) {
|
||||||
case KmsProviders.Aws:
|
case KmsProviders.Aws:
|
||||||
{
|
{
|
||||||
const externalKms = await AwsKmsProviderFactory({ inputs: provider.inputs }).catch((error: Error) => {
|
const externalKms = await AwsKmsProviderFactory({ inputs: provider.inputs }).catch((error) => {
|
||||||
throw new InternalServerError({
|
if (error instanceof STSServiceException || error instanceof KMSServiceException) {
|
||||||
message: error.message ? `AWS error: ${error.message}` : ""
|
throw new InternalServerError({
|
||||||
});
|
message: error.message ? `AWS error: ${error.message}` : ""
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
throw error;
|
||||||
});
|
});
|
||||||
|
|
||||||
// if missing kms key this generate a new kms key id and returns new provider input
|
// if missing kms key this generate a new kms key id and returns new provider input
|
||||||
|
|||||||
Reference in New Issue
Block a user