aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2023-07-25 16:26:14 -0700
committerFuwn <[email protected]>2023-07-25 16:26:14 -0700
commit512d29f65c69ad9e1ba337820e9d95d0c3bb880e (patch)
tree935c2c8995e668f4ef59402a73eea8f4e6c41272
parentfix(due): secure secret key (diff)
downloadold.due.moe-0.1.2.tar.xz
old.due.moe-0.1.2.zip
feat(due): generic error handlerv0.1.2
-rw-r--r--src/due/__init__.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/due/__init__.py b/src/due/__init__.py
index eac39d4..5bbe471 100644
--- a/src/due/__init__.py
+++ b/src/due/__init__.py
@@ -1,5 +1,6 @@
from flask import Flask
from due.routes import auth, oauth, index
+from due.html import page
from flask_cors import CORS
from dotenv import load_dotenv
from due.cache import cache
@@ -16,4 +17,15 @@ app.register_blueprint(oauth.bp, url_prefix="/oauth")
app.register_blueprint(index.bp)
app.secret_key = os.getenv("SECRET_KEY")
+
+def error_handler(e):
+ return page(
+ """<p>You have encountered a critcal application error. This means that one or more media entries on your lists have resolved abnormaly.</p>
+ <p></p>
+ <p>Contact <a href="https://anilist.co/user/fuwn">Fuwn</a> on AniList for help; please, attach the error code below.</p>""",
+ f"<pre>{e}</pre>",
+ )
+
+
cache.init_app(app)