Skip to content

Commit

Permalink
improve codegen error log (#1324)
Browse files Browse the repository at this point in the history
Co-authored-by: Louise wang <louisewang118@.gmail.com>
  • Loading branch information
bighammerw and Louise wang committed Sep 29, 2022
1 parent c55911b commit c9e3121
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/common/src/project/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,14 @@ export function getSchemaPath(file: string) {
if ((yamlFile as any).specVersion === '0.0.1') {
return path.join(file, (yamlFile as any).schema);
}
return path.join(file, (yamlFile as ProjectManifestV0_2_0).schema.file);
const project = yamlFile as ProjectManifestV0_2_0;
if (!project.schema) {
throw new Error(`Can't get schema in yaml file`);
}
if (!project.schema.file) {
throw new Error(`schemaPath expect to be schema.file`);
}
return path.join(file, project.schema.file);
}

// Only work for manifest specVersion >= 1.0.0
Expand Down

0 comments on commit c9e3121

Please sign in to comment.