From e41f11a8c3bff28b0dce6f05b6a34dbe61a8f302 Mon Sep 17 00:00:00 2001 From: jscampucci Date: Tue, 9 Jul 2024 13:12:04 +0200 Subject: [PATCH] [clean] manage errors --- lib/services/download.dart | 16 ++++++++++++---- lib/videoList/cubit/videos_cubit.dart | 1 + 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/services/download.dart b/lib/services/download.dart index a0600eb..536cc02 100644 --- a/lib/services/download.dart +++ b/lib/services/download.dart @@ -119,14 +119,22 @@ class DLServices { await shell.run(''' $ytDlpPath $command ''').then((result) { - debugPrint('Analyse error: $result'); - - FileLogger().d('Analyse result: ${result.toString()}'); + result.map((e) { + debugPrint('Analyse result: $e'); + FileLogger().d('Analyse result: ${e.toString()}'); + FileLogger().d('stdout: ${e.stdout}'); + FileLogger().d('stderr: ${e.stderr}'); + }); }).catchError(( error, stackTrace, ) { - FileLogger().e('Analyse error: $error'); + error.map((e) { + debugPrint('Analyse result: $e'); + FileLogger().d('Analyse result: ${e.toString()}'); + FileLogger().d('stdout: ${e.stdout}'); + FileLogger().d('stderr: ${e.stderr}'); + }); }); return shellLinesController.stream; diff --git a/lib/videoList/cubit/videos_cubit.dart b/lib/videoList/cubit/videos_cubit.dart index 2736fab..3fab52e 100644 --- a/lib/videoList/cubit/videos_cubit.dart +++ b/lib/videoList/cubit/videos_cubit.dart @@ -112,6 +112,7 @@ class VideosCubit extends Cubit { } Future moveVideos() async { + debugPrint('Moving videos to download folder'); final prefs = await SharedPreferences.getInstance(); Directory defaultDownloadDirectory = await getDownloadDirectory(); prefs.get('downloadFolder') ??