Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Check error before handling (#37801)

Saxon Fletcherf28e6e9c8fad
diff --git a/apps/studio/components/ui/AIAssistantPanel/AIAssistant.utils.ts b/apps/studio/components/ui/AIAssistantPanel/AIAssistant.utils.ts
index c3ad2cc47fd..c593efce4a7 100644
--- a/apps/studio/components/ui/AIAssistantPanel/AIAssistant.utils.ts
+++ b/apps/studio/components/ui/AIAssistantPanel/AIAssistant.utils.ts
@@ -106,7 +106,7 @@ export const getContextualInvalidationKeys = ({
}
export const onErrorChat = (error: Error) => {
- const parsedError = tryParseJson(error.message)
+ const parsedError = error ? tryParseJson(error.message) : undefined
try {
handleError(parsedError?.error || parsedError || error)