From 1ea563f4f1d24fe35650f83c3f5c0af88e0fa093 Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Thu, 8 Nov 2018 17:10:14 -0600 Subject: [PATCH] Add error message for fetching channel videos --- src/invidious.cr | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/invidious.cr b/src/invidious.cr index 72eb260a..867a70d3 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -2424,7 +2424,12 @@ get "/api/v1/channels/:ucid" do |env| end page = 1 - videos, count = get_60_videos(ucid, page, auto_generated) + begin + videos, count = get_60_videos(ucid, page, auto_generated) + rescue ex + error_message = {"error" => ex.message}.to_json + halt env, status_code: 500, response: error_message + end client = make_client(YT_URL) channel_html = client.get("/channel/#{ucid}/about?disable_polymer=1").body @@ -2565,7 +2570,12 @@ end halt env, status_code: 500, response: error_message end - videos, count = get_60_videos(ucid, page, auto_generated) + begin + videos, count = get_60_videos(ucid, page, auto_generated) + rescue ex + error_message = {"error" => ex.message}.to_json + halt env, status_code: 500, response: error_message + end result = JSON.build do |json| json.array do