what if the error message was better

This commit is contained in:
Party Wumpus
2024-02-22 17:37:20 +00:00
parent 89a4a69f6d
commit 637e3c566e
+8
View File
@@ -34,12 +34,20 @@ interface ErrorMessage {
id: number;
}
/**
* An error from a python call
*/
export class PyError extends Error {
pythonTraceback: string | null;
constructor(name: string, message: string, traceback: string | null) {
super(message);
this.name = `Python ${name}`;
if (traceback) {
// traceback will always start with `Traceback (most recent call last):`
// so this will make it say `Python Traceback (most recent call last):` after the JS callback
this.stack = this.stack + '\n\nPython ' + traceback;
}
this.pythonTraceback = traceback;
}
}