Skip to content

Commit 3758bca

Browse files
authored
fix(schema-compiler): Pass filename alongside with errors to error reporter during transpilation (#9964)
1 parent 8aa3562 commit 3758bca

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

packages/cubejs-schema-compiler/src/compiler/DataSchemaCompiler.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ export class DataSchemaCompiler {
627627
errorsReport.error(`No transpilation result received for the file ${file.fileName}.`);
628628
return undefined;
629629
}
630-
errorsReport.addErrors(res[index].errors);
630+
errorsReport.addErrors(res[index].errors, file.fileName);
631631
errorsReport.addWarnings(res[index].warnings as unknown as SyntaxErrorInterface[]);
632632
errorsReport.exitFile();
633633

@@ -654,7 +654,7 @@ export class DataSchemaCompiler {
654654
errorsReport.error(`No transpilation result received for the file ${file.fileName}.`);
655655
return undefined;
656656
}
657-
errorsReport.addErrors(res[index].errors);
657+
errorsReport.addErrors(res[index].errors, file.fileName);
658658
errorsReport.addWarnings(res[index].warnings as unknown as SyntaxErrorInterface[]);
659659
errorsReport.exitFile();
660660

@@ -686,7 +686,7 @@ export class DataSchemaCompiler {
686686

687687
errorsReport.inFile(file);
688688
const res = await transpileJs([reqData]);
689-
errorsReport.addErrors(res[0].errors);
689+
errorsReport.addErrors(res[0].errors, file.fileName);
690690
errorsReport.addWarnings(res[0].warnings as unknown as SyntaxErrorInterface[]);
691691
errorsReport.exitFile();
692692

@@ -701,7 +701,7 @@ export class DataSchemaCompiler {
701701
};
702702

703703
const res = await this.workerPool!.exec('transpileJs', [data]);
704-
errorsReport.addErrors(res.errors);
704+
errorsReport.addErrors(res.errors, file.fileName);
705705
errorsReport.addWarnings(res.warnings);
706706

707707
return { ...file, content: res.content };
@@ -761,7 +761,7 @@ export class DataSchemaCompiler {
761761

762762
errorsReport.inFile(file);
763763
const res = await transpileYaml([reqData]);
764-
errorsReport.addErrors(res[0].errors);
764+
errorsReport.addErrors(res[0].errors, file.fileName);
765765
errorsReport.addWarnings(res[0].warnings as unknown as SyntaxErrorInterface[]);
766766
errorsReport.exitFile();
767767

@@ -778,7 +778,7 @@ export class DataSchemaCompiler {
778778
};
779779

780780
const res = await this.workerPool!.exec('transpileYaml', [data]);
781-
errorsReport.addErrors(res.errors);
781+
errorsReport.addErrors(res.errors, file.fileName);
782782
errorsReport.addWarnings(res.warnings);
783783

784784
this.compiledYamlCache.set(cacheKey, res.content);

packages/cubejs-schema-compiler/src/compiler/ErrorReporter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ export class ErrorReporter {
147147
return this.rootReporter().errors;
148148
}
149149

150-
public addErrors(errors: PossibleError[]) {
151-
errors.forEach((e: any) => { this.error(e); });
150+
public addErrors(errors: PossibleError[], fileName?: string) {
151+
errors.forEach((e: any) => { this.error(e, fileName); });
152152
}
153153

154154
public getWarnings() {

0 commit comments

Comments
 (0)