refactor(youtube): log service failures and decouple error messages
YouTubeMusicService swallowed the exception into an ErrorOr description with no trace on the server side. Adds ILogger to the three operations. The download activity no longer names yt-dlp in its messages, since the downloader is an implementation detail behind IYouTubeDownloaderService.
This commit is contained in:
+2
-2
@@ -43,10 +43,10 @@ namespace Musify.Infrastructure.MassTransit.Activities.Audio
|
||||
|
||||
if (downloadResult.ExitCode != 0)
|
||||
throw new InvalidOperationException(
|
||||
$"yt-dlp failed with exit code {downloadResult.ExitCode}: {downloadResult.StandardError}");
|
||||
$"YouTube audio download failed: {downloadResult.StandardError}");
|
||||
|
||||
if (!File.Exists(destinationPath))
|
||||
throw new InvalidOperationException($"yt-dlp did not produce the expected file {destinationPath}.");
|
||||
throw new InvalidOperationException($"YouTube audio download did not produce the expected file {destinationPath}.");
|
||||
|
||||
logger.LogInformation("Downloaded YouTube audio for video {VideoId} to {DestinationPath}",
|
||||
executeContext.Arguments.VideoId, destinationPath);
|
||||
|
||||
Reference in New Issue
Block a user