From 53d0ffcd112ebf8fbce20f2b072d67cc639a0887 Mon Sep 17 00:00:00 2001 From: Danny Avila <110412045+danny-avila@users.noreply.github.com> Date: Thu, 30 Nov 2023 13:29:55 -0500 Subject: [PATCH] Fix: catch uncaught OpenAIError handling in server index.js and log info (#1248) --- api/server/index.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/api/server/index.js b/api/server/index.js index dd497282fb..d8d1c18053 100644 --- a/api/server/index.js +++ b/api/server/index.js @@ -101,7 +101,16 @@ process.on('uncaughtException', (err) => { console.error('Meilisearch error, search will be disabled'); messageCount++; } - } else { - process.exit(1); + + return; } + + if (err.message.includes('OpenAIError')) { + console.error( + '\n\nAn Uncaught `OpenAIError` error may be due to your reverse-proxy setup or stream configuration, or a bug in the `openai` node package.', + ); + return; + } + + process.exit(1); });