From 154c44e9c5d3edd5d7495ef17d8357f334cb900c Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 7 Dec 2022 17:05:58 -0800 Subject: [PATCH] Add exception handling to execution of image generation script So that if the script fails for some reason, the server doesn't crash. --- index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index ba01d67..638c59d 100644 --- a/index.js +++ b/index.js @@ -84,7 +84,11 @@ io.on('connection', (socket) => { child.stderr.on('data', (data) => { console.log("Error occurred during generate-image: " + data); }); - const { stdout, stderr } = await promise; + try { + const { stdout, stderr } = await promise; + } catch(e) { + console.error(e); + } socket.emit('generation-done'); } generate_image(request['code'], request['prompt']); -- 2.43.0