From 56ba453d95a7ac6ebfe65568a656ffae82efcfd3 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Wed, 28 Jul 2021 15:37:15 +0200 Subject: [PATCH] YoutubeAPI: add logging on API error --- src/invidious/helpers/youtube_api.cr | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/invidious/helpers/youtube_api.cr b/src/invidious/helpers/youtube_api.cr index ce00f5cc..fd0d8f81 100644 --- a/src/invidious/helpers/youtube_api.cr +++ b/src/invidious/helpers/youtube_api.cr @@ -410,6 +410,11 @@ module YoutubeAPI code = initial_data["error"]["code"] message = initial_data["error"]["message"].to_s.sub(/(\\n)+\^$/, "") + # Logging + LOGGER.error("YoutubeAPI: Got error #{code} when requesting #{endpoint}") + LOGGER.error("YoutubeAPI: #{message}") + LOGGER.info("YoutubeAPI: POST data was: #{data.to_s}") + raise InfoException.new("Could not extract JSON. Youtube API returned \ error #{code} with message:
\"#{message}\"") end