Skip to content

Commit

Permalink
Error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
siefkenj committed Mar 19, 2024
1 parent 264093c commit fa71152
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/unified-latex-prettier/libs/printer/printer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,20 @@ export function printLatexAst(
case "whitespace":
return line;
default:
console.warn("Printing unknown type", node);
console.warn(`Printing unknown type ${readableType(node)}`, node);
return printRaw(node);
}
}

/**
* Get a printable type for an object.
*/
function readableType(obj: any): string {
if (obj == null) {
return "null";
}
if (Array.isArray(obj)) {
return "array";
}
return typeof obj;
}

0 comments on commit fa71152

Please sign in to comment.