aboutsummaryrefslogtreecommitdiffstats
path: root/server.py
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2018-12-20 01:11:50 -0800
committerJames Taylor <user234683@users.noreply.github.com>2018-12-20 01:11:50 -0800
commita8d74ba082404bac016b210d151fb2d46cbd54d9 (patch)
treedd8f6409edf999ec2ea0f0b1d2e05453dce3f949 /server.py
parent9d1c688310849f897c5fc7b3f37ab3ddeac67a9b (diff)
downloadyt-local-a8d74ba082404bac016b210d151fb2d46cbd54d9.tar.lz
yt-local-a8d74ba082404bac016b210d151fb2d46cbd54d9.tar.xz
yt-local-a8d74ba082404bac016b210d151fb2d46cbd54d9.zip
Correctly handle case where channel doesn't exist
Diffstat (limited to 'server.py')
-rw-r--r--server.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/server.py b/server.py
index beab5c0..fc9a731 100644
--- a/server.py
+++ b/server.py
@@ -4,6 +4,7 @@ import gevent.socket
from gevent.pywsgi import WSGIServer
from youtube.youtube import youtube
+import http_errors
import urllib
import socket
import socks
@@ -114,7 +115,10 @@ def site_dispatch(env, start_response):
yield error_code('404 Not Found', start_response)
return
-
+ except http_errors.Error404 as e:
+ start_response('404 Not Found', ())
+ yield str(e).encode('utf-8')
+
except socket.error as e:
start_response('502 Bad Gateway', ())
print(str(e))