improve logging

This commit is contained in:
otsmr 2026-02-21 01:41:07 +01:00
parent 80910c1ba0
commit cf0132e75b
2 changed files with 13 additions and 1 deletions

View file

@ -193,7 +193,11 @@ class ApiService {
}
Future<void> _onError(dynamic e) async {
if (e.toString().contains('Failed host lookup')) {
Log.info('WebSocket connection failed: Host not reachable.');
} else {
Log.warn('websocket error: $e');
}
await onClosed();
}

View file

@ -37,6 +37,14 @@ Future<bool> canMediaFileBeDownloaded(MediaFile mediaFile) async {
// If not delete the message as it can not be downloaded from the server anymore.
if (messages.length != 1) {
if (messages.isEmpty) {
MediaFileService(mediaFile).fullMediaRemoval();
await twonlyDB.mediaFilesDao.deleteMediaFile(mediaFile.mediaId);
Log.warn(
'Media file which is in downloading status has not text message. Deleting media file. ${mediaFile.mediaId}.',
);
return false;
}
Log.warn(
'A media for download must have one original message, but it has ${messages.length}.',
);