Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(crossRegionReference): error message missing stack information #29961

Merged
merged 2 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading