1
0
Fork 0
mirror of synced 2024-07-02 04:50:44 +12:00

Display errors

This commit is contained in:
Adria Navarro 2023-06-27 09:25:46 +01:00
parent b075f4db1b
commit c9bee9e423

View file

@ -151,9 +151,17 @@ class SqlServerIntegration extends Sql implements DatasourcePlus {
async connect() {
try {
this.client = await this.pool.connect()
} catch (err) {
// @ts-ignore
throw new Error(err)
} catch (err: any) {
if (err?.originalError?.errors?.length) {
const messages = []
if (err.message) {
messages.push(err.message)
}
messages.push(...err.originalError.errors.map((e: any) => e.message))
throw new Error(messages.join("\n"))
}
throw err
}
}