Skip to content

Commit 9a40f72

Browse files
simonljusCode-Hex
authored andcommitted
throw detailed error message instead of npe
1 parent 28b3400 commit 9a40f72

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/visitor.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,12 @@ export class Visitor extends TsVisitor {
4242
public getScalarType(scalarName: string): string | null {
4343
if (this.scalarDirection === 'both')
4444
return null;
45-
46-
return this.scalars[scalarName][this.scalarDirection];
45+
}
46+
const scalar = this.scalars[scalarName];
47+
if (!scalar) {
48+
throw new Error(`Unknown scalar ${scalarName}`);
49+
}
50+
return scalar[this.scalarDirection];
4751
}
4852

4953
public shouldEmitAsNotAllowEmptyString(name: string): boolean {

0 commit comments

Comments
 (0)