diff options
| author | Fuwn <[email protected]> | 2023-07-25 16:26:14 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-07-25 16:26:14 -0700 |
| commit | 512d29f65c69ad9e1ba337820e9d95d0c3bb880e (patch) | |
| tree | 935c2c8995e668f4ef59402a73eea8f4e6c41272 | |
| parent | fix(due): secure secret key (diff) | |
| download | old.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__.py | 12 |
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") + [email protected](Exception) +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) |