fluffychat
fluffychat copied to clipboard
database error notifications need a fallback
Bug Description
errors on constructing a database don't appear anywhere if a user dbus socket doesn't exist.
https://github.com/krille-chan/fluffychat/blob/3a554a43b42d735fe553b7780a52d8c17a33053c/lib/utils/matrix_sdk_extensions/flutter_matrix_dart_sdk_database/builder.dart#L39
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: SocketException: Connection failed (OS Error: No such file or directory, errno = 2), address = /run/user/1000/bus, port = 0
#0 _NativeSocket.startConnect (dart:io-patch/socket_patch.dart:721)
#1 _NativeSocket.connect (dart:io-patch/socket_patch.dart:984)
#2 _RawSocket.connect (dart:io-patch/socket_patch.dart:1902)
#3 RawSocket.connect (dart:io-patch/socket_patch.dart:21)
#4 DBusClient._openSocket (package:dbus/src/dbus_client.dart:780)
#5 DBusClient._connect (package:dbus/src/dbus_client.dart:800)
#6 DBusClient.callMethod (package:dbus/src/dbus_client.dart:620)
#7 DBusClient.getNameOwner (package:dbus/src/dbus_client.dart:461)
#8 DBusClient._findUniqueName (package:dbus/src/dbus_client.dart:637)
#9 DBusSignalStream._onListen (package:dbus/src/dbus_client.dart:132)
#10 _runGuarded (dart:async/stream_controller.dart:823)
#11 _BroadcastStreamController._subscribe (dart:async/broadcast_stream_controller.dart:207)
#12 _ControllerStream._createSubscription (dart:async/stream_controller.dart:836)
#13 _StreamImpl.listen (dart:async/stream_impl.dart:471)
#14 DBusSignalStream.listen (package:dbus/src/dbus_client.dart:124)
#15 NotificationsClient._subscribeSignals (package:desktop_notifications/src/notifications_client.dart:343)
#16 NotificationsClient.notify (package:desktop_notifications/src/notifications_client.dart:257)
#17 ClientManager.sendInitNotification (package:fluffychat/utils/client_manager.dart:136)
#18 flutterMatrixSdkDatabaseBuilder (package:fluffychat/utils/matrix_sdk_extensions/flutter_matrix_dart_sdk_database/builder.dart:39)
<asynchronous suspension>
#19 Client.init.<anonymous closure> (package:matrix/src/client.dart:1594)
<asynchronous suspension>
#20 Client.init (package:matrix/src/client.dart:1592)
<asynchronous suspension>
#21 InitWithRestoreExtension.initWithRestore (package:fluffychat/utils/init_with_restore.dart:72)
<asynchronous suspension>
#22 Future.wait.<anonymous closure> (dart:async/future.dart:518)
<asynchronous suspension>
#23 ClientManager.getClients (package:fluffychat/utils/client_manager.dart:48)
<asynchronous suspension>
#24 main (package:fluffychat/main.dart:26)
<asynchronous suspension>
Steps to Reproduce
- idk, do something so the db doesn't work
- start the app
Expected Behavior
fallback to an in-app dialog? stdout?
App Version
1.19.1
Additional Platform Information
Alpine Linux edge
Additional Context
problem with investigating the actual database error
what i do for now:
--- ./lib/utils/matrix_sdk_extensions/flutter_matrix_dart_sdk_database/builder.dart.orig
+++ ./lib/utils/matrix_sdk_extensions/flutter_matrix_dart_sdk_database/builder.dart
@@ -36,12 +36,14 @@
// Send error notification:
final l10n = lookupL10n(PlatformDispatcher.instance.locale);
+ final errorText = l10n.databaseBuildErrorBody(
+ AppConfig.newIssueUrl.toString(),
+ e.toString(),
+ );
+ print(errorText);
ClientManager.sendInitNotification(
l10n.initAppError,
- l10n.databaseBuildErrorBody(
- AppConfig.newIssueUrl.toString(),
- e.toString(),
- ),
+ errorText,
);
return FlutterHiveCollectionsDatabase.databaseBuilder(client);
Thank you so much, for reporting this. Hm I would for now try to handle this by wrapping the sendInitNotification and also the lookup into a try catch block with better logs. Also I added logs always when the database can't be constructed with a higher loglevel. Can you try again with the latest commit?
This issue is stale because it has been open for 120 days with no activity.