Skip to content

Commit

Permalink
updated cli error message and added new unit test
Browse files Browse the repository at this point in the history
Signed-off-by: Francis <colifran@amazon.com>
  • Loading branch information
colifran committed Mar 7, 2024
1 parent 08b2c66 commit 79b6fcc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/aws-cdk/lib/commands/migrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ export async function generateCdkApp(stackName: string, stack: string, language:
* @returns A string representation of a CDK stack file
*/
export function generateStack(template: string, stackName: string, language: string) {
const formattedStackName = `${camelCase(decamelize(stackName), { pascalCase: true })}Stack`;
try {
const formattedStackName = `${camelCase(decamelize(stackName), { pascalCase: true })}Stack`;
return cdk_from_cfn.transmute(template, language, formattedStackName);
} catch (e) {
throw new Error(`stack generation failed due to error '${(e as Error).message}'`);
throw new Error(`${formattedStackName} could not be generated because ${(e as Error).message}`);
}
}

Expand Down

0 comments on commit 79b6fcc

Please # to comment.