1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Error handling details

This commit is contained in:
krateng 2021-12-09 19:49:53 +01:00
parent e17002299b
commit 56eaa8a793
2 changed files with 7 additions and 5 deletions

View File

@ -51,9 +51,11 @@ dbstatus = {
}
class DatabaseNotBuilt(HTTPError):
def __init__(self):
super().__init__()
self.status = 503
self.body = "The Maloja Database is still being built. Try again in a few seconds."
super().__init__(
status=503,
body="The Maloja Database is still being built. Try again in a few seconds.",
headers={"Retry-After":10}
)
SCROBBLES = [] # Format: tuple(track_ref,timestamp,saved)
ARTISTS = [] # Format: artist

View File

@ -270,8 +270,8 @@ def register_endpoints_web_dynamic():
template = jinja_environment.get_template(name + '.jinja')
try:
res = template.render(**LOCAL_CONTEXT)
except ValueError as e:
abort(404,"Entity does not exist")
except (ValueError, IndexError) as e:
abort(404,"This Artist or Track does not exist")
if settings.get_settings("DEV_MODE"): jinja_environment.cache.clear()