Improve error messages relating to failing to connect to datasources.
This commit is contained in:
parent
1573242031
commit
a773841518
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue