diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-11-08 17:10:14 -0600 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-11-08 17:10:14 -0600 |
| commit | 1ea563f4f1d24fe35650f83c3f5c0af88e0fa093 (patch) | |
| tree | 13088b6d43506addac80690ee6d06e51b97b8811 /src | |
| parent | c5d2a57206f01706391c8d19a2d78a711af59621 (diff) | |
| download | invidious-1ea563f4f1d24fe35650f83c3f5c0af88e0fa093.tar.gz invidious-1ea563f4f1d24fe35650f83c3f5c0af88e0fa093.tar.bz2 invidious-1ea563f4f1d24fe35650f83c3f5c0af88e0fa093.zip | |
Add error message for fetching channel videos
Diffstat (limited to 'src')
| -rw-r--r-- | src/invidious.cr | 14 |
1 files 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 |
