fix: More logs when database fails to init and trycatch sendInitNotification
This commit is contained in:
parent
1b9eb6c61f
commit
5128785c66
1 changed files with 16 additions and 11 deletions
|
|
@ -24,25 +24,30 @@ Future<DatabaseApi> flutterMatrixSdkDatabaseBuilder(Client client) async {
|
||||||
database = await _constructDatabase(client);
|
database = await _constructDatabase(client);
|
||||||
await database.open();
|
await database.open();
|
||||||
return database;
|
return database;
|
||||||
} catch (e) {
|
} catch (e, s) {
|
||||||
|
Logs().wtf('Unable to construct database!', e, s);
|
||||||
// Try to delete database so that it can created again on next init:
|
// Try to delete database so that it can created again on next init:
|
||||||
database?.delete().catchError(
|
database?.delete().catchError(
|
||||||
(e, s) => Logs().w(
|
(e, s) => Logs().wtf(
|
||||||
'Unable to delete database, after failed construction',
|
'Unable to delete database, after failed construction',
|
||||||
e,
|
e,
|
||||||
s,
|
s,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Send error notification:
|
try {
|
||||||
final l10n = lookupL10n(PlatformDispatcher.instance.locale);
|
// Send error notification:
|
||||||
ClientManager.sendInitNotification(
|
final l10n = lookupL10n(PlatformDispatcher.instance.locale);
|
||||||
l10n.initAppError,
|
ClientManager.sendInitNotification(
|
||||||
l10n.databaseBuildErrorBody(
|
l10n.initAppError,
|
||||||
AppConfig.newIssueUrl.toString(),
|
l10n.databaseBuildErrorBody(
|
||||||
e.toString(),
|
AppConfig.newIssueUrl.toString(),
|
||||||
),
|
e.toString(),
|
||||||
);
|
),
|
||||||
|
);
|
||||||
|
} catch (e, s) {
|
||||||
|
Logs().e('Unable to send error notification', e, s);
|
||||||
|
}
|
||||||
|
|
||||||
return FlutterHiveCollectionsDatabase.databaseBuilder(client);
|
return FlutterHiveCollectionsDatabase.databaseBuilder(client);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue