Skip to content

Commit

Permalink
fix: errors for sourceless nodes (#1552)
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurfiorette authored Jan 31, 2023
1 parent b518884 commit 48775f9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Error/UnknownNodeError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import { BaseError } from "./BaseError";

export class UnknownNodeError extends BaseError {
public constructor(private node: ts.Node, private reference?: ts.Node) {
super(`Unknown node "${node.getFullText()}" of kind "${ts.SyntaxKind[node.kind]}"`);
super(
`Unknown node "${node.getSourceFile() ? node.getFullText() : "<unknown>"}" of kind "${
ts.SyntaxKind[node.kind]
}"`
);
}

public getNode(): ts.Node {
Expand Down

0 comments on commit 48775f9

Please sign in to comment.