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:
2026-07-20 07:27:57 +02:00
parent e2ef2da4c3
commit d1915481e0
2 changed files with 7 additions and 3 deletions
@@ -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);