diff --git a/packages/builder/src/components/integration/QueryViewer.svelte b/packages/builder/src/components/integration/QueryViewer.svelte index 59a3289731..42ebcb7693 100644 --- a/packages/builder/src/components/integration/QueryViewer.svelte +++ b/packages/builder/src/components/integration/QueryViewer.svelte @@ -93,7 +93,13 @@ notifications.success("Query executed successfully") } catch (error) { - notifications.error(`Query Error: ${error.message}`) + if (typeof error.message === "string") { + notifications.error(`Query Error: ${error.message}`) + } else if (typeof error.message?.code === "string") { + notifications.error(`Query Error: ${error.message.code}`) + } else { + notifications.error(`Query Error: ${JSON.stringify(error.message)}`) + } if (!suppressErrors) { throw error diff --git a/packages/server/src/integrations/postgres.ts b/packages/server/src/integrations/postgres.ts index 78955c06dc..e1f4cc2fc7 100644 --- a/packages/server/src/integrations/postgres.ts +++ b/packages/server/src/integrations/postgres.ts @@ -202,8 +202,13 @@ class PostgresIntegration extends Sql implements DatasourcePlus { await this.openConnection() response.connected = true } catch (e: any) { - console.log(e) - response.error = e.message as string + if (typeof e.message === "string" && e.message !== "") { + response.error = e.message as string + } else if (typeof e.code === "string" && e.code !== "") { + response.error = e.code + } else { + response.error = "Unknown error" + } } finally { await this.closeConnection() }