From 881d8d6976f5c188871043fcc3dd853e30065cf2 Mon Sep 17 00:00:00 2001 From: Radon Rosborough Date: Mon, 22 Jun 2020 21:04:22 -0600 Subject: [PATCH] Report errors on frontend --- backend/src/api.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/backend/src/api.ts b/backend/src/api.ts index 2c905e9..27f9ba0 100644 --- a/backend/src/api.ts +++ b/backend/src/api.ts @@ -42,6 +42,19 @@ export class Session { this.run().catch((err) => { this.log(`Error while setting up environment for pty`); console.log(err); + try { + this.ws.send(JSON.stringify({ event: "terminalClear" })); + this.ws.send( + JSON.stringify({ + event: "terminalOutput", + output: `Riju encountered an unexpected error: ${err} +\rYou may want to save your code and refresh the page. +`, + }) + ); + } catch (err) { + // + } }); } handleClientMessage = (event: string) => {