From 4e70bdc3216fc5e6519c52e9dc9865fcb9dd1ebf Mon Sep 17 00:00:00 2001 From: iliana etaoin Date: Thu, 11 Feb 2021 21:08:43 -0800 Subject: [PATCH] remove unnecessary exception class --- app/emojos.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/app/emojos.py b/app/emojos.py index 15c5c81..baa1e55 100644 --- a/app/emojos.py +++ b/app/emojos.py @@ -24,10 +24,6 @@ from flask import Flask, redirect, render_template, request, url_for app = Flask(__name__) -class ForbiddenEndpointError(Exception): - pass - - @app.route("/") def emojo(domain): if request.args.get("show_all", "") == "on": @@ -45,7 +41,7 @@ def emojo(domain): ) response = requests.get(url) if response.status_code == 401: - raise ForbiddenEndpointError + return render_template("forbidden.html", domain=domain) if show_all: emojo = sorted(response.json(), key=operator.itemgetter("shortcode")) @@ -59,8 +55,6 @@ def emojo(domain): ) except requests.exceptions.RequestException: return render_template("oh_no.html", domain=domain) - except ForbiddenEndpointError: - return render_template("forbidden.html", domain=domain) @app.route("/favicon.ico")