Skip to content

Commit

Permalink
fix(cli): failure to load malformed YAML is swallowed
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rix0rrr authored Mar 11, 2022
1 parent 1bc5144 commit d900ef9
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions packages/aws-cdk/lib/serialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@ export function toYAML(obj: any): string {
* Parse either YAML or JSON
*/
export function deserializeStructure(str: string): any {
try {
return yaml_cfn.deserialize(str);
} catch (e) {
// This shouldn't really ever happen I think, but it's the code we had so I'm leaving it.
return JSON.parse(str);
}
return yaml_cfn.deserialize(str);
}

/**
Expand Down

0 comments on commit d900ef9

Please sign in to comment.