Skip to content

Commit c48c260

Browse files
authored
Merge pull request #96 from devforth/fix-connector-crash
fix: prevent failed db connect from stopping node process
2 parents 87088a7 + 5ae95b4 commit c48c260

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

adminforth/dataConnectors/mongo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class MongoConnector extends AdminForthBaseConnector implements IAdminForthDataS
2121
});
2222
console.log('Connected to Mongo');
2323
} catch (e) {
24-
throw new Error(`Failed to connect to Mongo: ${e}`);
24+
console.error(`Failed to connect to Mongo: ${e}`);
2525
}
2626
})();
2727
}

adminforth/dataConnectors/mysql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class MysqlConnector extends AdminForthBaseConnector implements IAdminForthDataS
1010
try {
1111
this.client = await mysql.createConnection(url);
1212
} catch (e) {
13-
throw new Error(`Failed to connect to MySQL: ${e}`);
13+
console.error(`Failed to connect to MySQL: ${e}`);
1414
}
1515
}
1616

adminforth/dataConnectors/postgres.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class PostgresConnector extends AdminForthBaseConnector implements IAdminForthDa
2121
this.setupClient(url);
2222
});
2323
} catch (e) {
24-
throw new Error(`Failed to connect to Postgres ${e}`);
24+
console.error(`Failed to connect to Postgres ${e}`);
2525
}
2626
}
2727

0 commit comments

Comments
 (0)