Skip to content

SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.

Enhance error handling in network requests within chatUtils

Salman-Ahamedc2b4000efacb
diff --git a/packages/app/src/react/features/ai-chat/utils/index.ts b/packages/app/src/react/features/ai-chat/utils/index.ts
index bab8798c..79d23407 100644
--- a/packages/app/src/react/features/ai-chat/utils/index.ts
+++ b/packages/app/src/react/features/ai-chat/utils/index.ts
@@ -322,7 +322,9 @@ export const chatUtils = {
signal: input.signal,
});
} catch (fetchError) {
- throw new Error(`Network request failed: ${fetchError.message}`);
+ throw new Error(
+ `Network request failed: ${fetchError.message || fetchError.error || 'Unknown error'}`,
+ );
}
if (!openAiResponse || openAiResponse?.status !== 200) {