diff --git a/lib/app/pages/source_page.dart b/lib/app/pages/source_page.dart index fe1526a..58573ae 100644 --- a/lib/app/pages/source_page.dart +++ b/lib/app/pages/source_page.dart @@ -8,6 +8,7 @@ import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import '../../database/database.dart'; +import '../../log.dart'; import '../../models/settings.dart'; import '../../services/settings_service.dart'; import '../items.dart'; @@ -161,8 +162,9 @@ class SourcePage extends HookConsumerWidget { ), ); } - } catch (err) { + } catch (e, st) { // TOOD: toast the error or whatever + log.severe('Saving source', e, st); error = true; } finally { isSaving.value = false; diff --git a/lib/database/database.dart b/lib/database/database.dart index e7ae304..d623cf4 100644 --- a/lib/database/database.dart +++ b/lib/database/database.dart @@ -440,7 +440,7 @@ LazyDatabase _openConnection() { return ErrorLoggingDatabase( NativeDatabase.createInBackground(file), - (e, s) => log.severe('SQL Error', e, s), + (e, s) => log.severe('SQL error', e, s), ); }); } diff --git a/lib/services/audio_service.dart b/lib/services/audio_service.dart index af7de98..e48bd91 100644 --- a/lib/services/audio_service.dart +++ b/lib/services/audio_service.dart @@ -95,32 +95,36 @@ class AudioControl extends BaseAudioHandler with QueueHandler, SeekHandler { int get _sourceId => _ref.read(sourceIdProvider); AudioControl(this._player, this._ref) { - _player.playbackEventStream.listen((PlaybackEvent event) { - final playing = _player.playing; - playbackState.add(playbackState.value.copyWith( - controls: [ - MediaControl.skipToPrevious, - if (playing) MediaControl.pause else MediaControl.play, - MediaControl.stop, - MediaControl.skipToNext, - ], - systemActions: const { - MediaAction.seek, - }, - androidCompactActionIndices: const [0, 1, 3], - processingState: const { - ProcessingState.idle: AudioProcessingState.idle, - ProcessingState.loading: AudioProcessingState.loading, - ProcessingState.buffering: AudioProcessingState.buffering, - ProcessingState.ready: AudioProcessingState.ready, - ProcessingState.completed: AudioProcessingState.completed, - }[_player.processingState]!, - playing: playing, - updatePosition: _player.position, - bufferedPosition: _player.bufferedPosition, - queueIndex: event.currentIndex, - )); - }); + _player.playbackEventStream.listen( + (PlaybackEvent event) { + final playing = _player.playing; + playbackState.add(playbackState.value.copyWith( + controls: [ + MediaControl.skipToPrevious, + if (playing) MediaControl.pause else MediaControl.play, + MediaControl.stop, + MediaControl.skipToNext, + ], + systemActions: const { + MediaAction.seek, + }, + androidCompactActionIndices: const [0, 1, 3], + processingState: const { + ProcessingState.idle: AudioProcessingState.idle, + ProcessingState.loading: AudioProcessingState.loading, + ProcessingState.buffering: AudioProcessingState.buffering, + ProcessingState.ready: AudioProcessingState.ready, + ProcessingState.completed: AudioProcessingState.completed, + }[_player.processingState]!, + playing: playing, + updatePosition: _player.position, + bufferedPosition: _player.bufferedPosition, + queueIndex: event.currentIndex, + )); + }, + onError: (e, st) => log.warning('Audio playback error', e, st), + cancelOnError: false, + ); shuffleIndicies.listen((value) { playbackState.add(playbackState.value.copyWith( diff --git a/lib/sources/subsonic/client.dart b/lib/sources/subsonic/client.dart index 7925e4d..6d51738 100644 --- a/lib/sources/subsonic/client.dart +++ b/lib/sources/subsonic/client.dart @@ -6,6 +6,7 @@ import 'package:crypto/crypto.dart'; import 'package:http/http.dart'; import 'package:xml/xml.dart'; +import '../../log.dart'; import '../../models/settings.dart'; import 'xml.dart'; @@ -89,7 +90,9 @@ class SubsonicClient { final subsonicResponse = SubsonicResponse(XmlDocument.parse(utf8.decode(res.bodyBytes))); if (subsonicResponse.status == Status.failed) { - throw SubsonicException(subsonicResponse.xml); + final error = SubsonicException(subsonicResponse.xml); + log.severe('Subsonic error', error); + throw error; } return subsonicResponse;