Skip to content
Merged
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
Prev Previous commit
exit early if yaml parsing fails
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
ShMcK committed Jun 7, 2020
commit 30985e4177a590c5b54a7ed10d7dc01da8c30cde
5 changes: 3 additions & 2 deletions src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,13 @@ async function build(args: string[]) {
let skeleton;
try {
skeleton = yamlParser.load(_yaml);
if (!skeleton || !skeleton.length) {
throw new Error("Invalid yaml file contents");
if (!skeleton || !Object.keys(skeleton).length) {
throw new Error(`Skeleton at "${options.yaml}" is invalid`);
}
} catch (e) {
console.error("Error parsing yaml");
console.error(e.message);
return;
}

// validate skeleton based on skeleton json schema
Expand Down