From 637e3c566e3aee04c57de008a0a0a8b5e95b447f Mon Sep 17 00:00:00 2001 From: Party Wumpus <48649272+PartyWumpus@users.noreply.github.com> Date: Thu, 22 Feb 2024 17:37:20 +0000 Subject: what if the error message was better --- frontend/src/wsrouter.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/frontend/src/wsrouter.ts b/frontend/src/wsrouter.ts index e3a6900b..34184a7f 100644 --- a/frontend/src/wsrouter.ts +++ b/frontend/src/wsrouter.ts @@ -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; } } -- cgit v1.2.3