aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/__init__.py
diff options
context:
space:
mode:
authorJesus E <heckyel@riseup.net>2023-06-19 21:23:25 -0400
committerJesus E <heckyel@riseup.net>2023-06-19 21:23:25 -0400
commitcc8f30eba2485d15522b6f9971182ed41185e160 (patch)
tree13303bf091e25d4d406016424a2d0708fda17b5f /youtube/__init__.py
parent6740afd6a05507837ea2dcf6cd65abd14ff7a2cd (diff)
downloadyt-local-cc8f30eba2485d15522b6f9971182ed41185e160.tar.lz
yt-local-cc8f30eba2485d15522b6f9971182ed41185e160.tar.xz
yt-local-cc8f30eba2485d15522b6f9971182ed41185e160.zip
Relax error and send error_code to template
Diffstat (limited to 'youtube/__init__.py')
-rw-r--r--youtube/__init__.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/youtube/__init__.py b/youtube/__init__.py
index 3604b21..b0e8761 100644
--- a/youtube/__init__.py
+++ b/youtube/__init__.py
@@ -115,7 +115,18 @@ def error_page(e):
error_message=exc_info()[1].error_message,
slim=slim
), 502)
- return flask.render_template('error.html', traceback=traceback.format_exc(), slim=slim), 500
+ elif (exc_info()[0] == util.FetchError
+ and exc_info()[1].code == '404'
+ ):
+ error_message = ('Error: The page you are looking for isn\'t here. ¯\_(ツ)_/¯')
+ return flask.render_template('error.html',
+ error_code=exc_info()[1].code,
+ error_message=error_message,
+ slim=slim), 404
+ return flask.render_template('error.html', traceback=traceback.format_exc(),
+ error_code=exc_info()[1].code,
+ slim=slim), 500
+ # return flask.render_template('error.html', traceback=traceback.format_exc(), slim=slim), 500
font_choices = {