Skip to content

Commit

Permalink
Better error message, when variable files are malformed
Browse files Browse the repository at this point in the history
  • Loading branch information
firecow committed Nov 22, 2023
1 parent c2bcf98 commit ab6c1db
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/variables-from-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export class VariablesFromFiles {
for (const [groupKey, groupEntries] of Object.entries(fileData?.group ?? {})) {
if (!groupUrl.includes(this.normalizeProjectKey(groupKey, writeStreams))) continue;
assert(groupEntries != null, "groupEntries cannot be null/undefined");
assert(typeof groupEntries === "object", "groupEntries must be object");
assert(typeof groupEntries === "object", "groupEntries in variable files must be object");
for (const [k, v] of Object.entries(groupEntries)) {
await addToVariables(k, v, 2 + filePriority);
}
Expand All @@ -102,7 +102,7 @@ export class VariablesFromFiles {
for (const [projectKey, projectEntries] of Object.entries(fileData?.project ?? [])) {
if (!projectUrl.includes(this.normalizeProjectKey(projectKey, writeStreams))) continue;
assert(projectEntries != null, "projectEntries cannot be null/undefined");
assert(typeof projectEntries === "object", "projectEntries must be object");
assert(typeof projectEntries === "object", "projectEntries in variable files must be object");
for (const [k, v] of Object.entries(projectEntries)) {
await addToVariables(k, v, 3 + filePriority);
}
Expand All @@ -116,7 +116,7 @@ export class VariablesFromFiles {
if (fs.existsSync(projectVariablesFile)) {
const projectVariablesFileData: any = yaml.load(await fs.readFile(projectVariablesFile, "utf8"), {schema: yaml.FAILSAFE_SCHEMA}) ?? {};
assert(projectVariablesFileData != null, "projectEntries cannot be null/undefined");
assert(typeof projectVariablesFileData === "object", "projectEntries must be object");
assert(typeof projectVariablesFileData === "object", "projectEntries in variable files must be object");
for (const [k, v] of Object.entries(projectVariablesFileData)) {
await addToVariables(k, v, 24);
}
Expand Down

0 comments on commit ab6c1db

Please sign in to comment.