backend-common: clarify DB connection error
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -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}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user