Skip to content

Commit

Permalink
fix: bad error checks in custom resources (#26392)
Browse files Browse the repository at this point in the history
Fixes bad error checking in custom resoruce for
cross-region-ssm-writer-handler and redshift cluster-reboot.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
MrArnoldPalmer authored Jul 18, 2023
1 parent 6c75581 commit 267e42c
Show file tree
Hide file tree
Showing 13 changed files with 876,330 additions and 31,491 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { Redshift } from '@aws-sdk/client-redshift';
import { InvalidClusterStateFault, Redshift } from '@aws-sdk/client-redshift';

const redshift = new Redshift({});

Expand All @@ -21,7 +21,7 @@ async function rebootClusterIfRequired(clusterId: string, parameterGroupName: st
try {
await redshift.rebootCluster({ ClusterIdentifier: clusterId });
} catch (err: any) {
if (err.code === 'InvalidClusterState') {
if (err instanceof InvalidClusterStateFault) {
return await executeActionForStatus(status, 30000);
} else {
throw err;
Expand Down
Loading

0 comments on commit 267e42c

Please sign in to comment.