From 174557ee4f9335c62be575044b26780d008b615c Mon Sep 17 00:00:00 2001 From: Dmitry Panov Date: Thu, 16 Apr 2020 21:22:32 +0100 Subject: [PATCH] Log a message when a '429 Too Many Requests' error is detected, in case of another error log the output from youtube-dl. (#121) Co-authored-by: Dmitry Panov --- cmd/podsync/updater.go | 1 + pkg/ytdl/ytdl.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/cmd/podsync/updater.go b/cmd/podsync/updater.go index d17ad912..aaad9b4b 100644 --- a/cmd/podsync/updater.go +++ b/cmd/podsync/updater.go @@ -186,6 +186,7 @@ func (u *Updater) downloadEpisodes(ctx context.Context, feedConfig *config.Feed) // We still need to generate XML, so just stop sending download requests and // retry next time if err == ytdl.ErrTooManyRequests { + logger.Warn("server responded with a 'Too Many Requests' error") break } diff --git a/pkg/ytdl/ytdl.go b/pkg/ytdl/ytdl.go index 4d01b13c..e5158ab2 100644 --- a/pkg/ytdl/ytdl.go +++ b/pkg/ytdl/ytdl.go @@ -79,6 +79,8 @@ func (dl YoutubeDl) Download(ctx context.Context, feedConfig *config.Feed, episo return nil, ErrTooManyRequests } + log.Error(output) + return nil, errors.New(output) }