backend-common: clarify DB connection error

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2021-06-15 11:54:05 +02:00
parent 59078de280
commit e5cdf0560f
2 changed files with 12 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/backend-common': patch
---
Provide a more clear error message when database connection fails.
@@ -77,6 +77,12 @@ export class SingleConnectionDatabaseManager {
private async ensureDatabase(database: string) {
const config = this.config;
await ensureDatabaseExists(config, database);
try {
await ensureDatabaseExists(config, database);
} catch (error) {
throw new Error(
`Failed to connect to the database to make sure that '${database}' exists, ${error}`,
);
}
}
}