Skip to content

Commit 1875c28

Browse files
authored
fix(cli): failure to load malformed YAML is swallowed (#19338)
For some reason, we are falling back to reading JSON when loading YAML fails. Since YAML is a superset of JSON, the only reason errors would occur because the YAML is not valid, in which case we shouldn't do this catch at all. Fixes #19335. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 1bc5144 commit 1875c28

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

packages/aws-cdk/lib/serialize.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,7 @@ export function toYAML(obj: any): string {
1212
* Parse either YAML or JSON
1313
*/
1414
export function deserializeStructure(str: string): any {
15-
try {
16-
return yaml_cfn.deserialize(str);
17-
} catch (e) {
18-
// This shouldn't really ever happen I think, but it's the code we had so I'm leaving it.
19-
return JSON.parse(str);
20-
}
15+
return yaml_cfn.deserialize(str);
2116
}
2217

2318
/**

0 commit comments

Comments
 (0)