Skip to content

Commit

Permalink
fix(crossRegionReference): error message missing stack information
Browse files Browse the repository at this point in the history
fixed aws#29699
  • Loading branch information
andreialecu committed Apr 25, 2024
1 parent db155e1 commit bc70984
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ async function throwIfAnyInUse(ssm: SSM, parameters: CrossRegionExports): Promis
}));

if (tagResults.size > 0) {
const message: string = Object.entries(tagResults)
.map((result: [string, string[]]) => `${result[0]} is in use by stack(s) ${result[1].join(' ')}`)
const message: string = Array.from(tagResults.entries())
.map((result) => `${result[0]} is in use by stack(s) ${Array.from(result[1]).join(' ')}`)
.join('\n');
throw new Error(`Exports cannot be updated: \n${message}`);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable import/no-extraneous-dependencies */
import { InvalidResourceId } from '@aws-sdk/client-ssm';
import { SSM_EXPORT_PATH_PREFIX } from '../../lib/core/types';
import { handler } from '../../lib/core/cross-region-ssm-writer-handler/index';
import { SSM_EXPORT_PATH_PREFIX } from '../../lib/core/types';

let mockPutParameter: jest.Mock = jest.fn() ;
let mocklistTagsForResource: jest.Mock = jest.fn();
Expand Down Expand Up @@ -96,7 +96,7 @@ describe('cross-region-ssm-writer entrypoint', () => {
});

// THEN
await expect(handler(event)).rejects.toThrow(/Exports cannot be updated/);
await expect(handler(event)).rejects.toThrow('Exports cannot be updated: \n/cdk/exports/MyStack/MyExport is in use by stack(s) MyStack');
});

test('Create event does not throw for new parameters', async () => {
Expand Down

0 comments on commit bc70984

Please sign in to comment.