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:
parent
e17002299b
commit
56eaa8a793
@ -51,9 +51,11 @@ dbstatus = {
|
|||||||
}
|
}
|
||||||
class DatabaseNotBuilt(HTTPError):
|
class DatabaseNotBuilt(HTTPError):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__(
|
||||||
self.status = 503
|
status=503,
|
||||||
self.body = "The Maloja Database is still being built. Try again in a few seconds."
|
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)
|
SCROBBLES = [] # Format: tuple(track_ref,timestamp,saved)
|
||||||
ARTISTS = [] # Format: artist
|
ARTISTS = [] # Format: artist
|
||||||
|
@ -270,8 +270,8 @@ def register_endpoints_web_dynamic():
|
|||||||
template = jinja_environment.get_template(name + '.jinja')
|
template = jinja_environment.get_template(name + '.jinja')
|
||||||
try:
|
try:
|
||||||
res = template.render(**LOCAL_CONTEXT)
|
res = template.render(**LOCAL_CONTEXT)
|
||||||
except ValueError as e:
|
except (ValueError, IndexError) as e:
|
||||||
abort(404,"Entity does not exist")
|
abort(404,"This Artist or Track does not exist")
|
||||||
|
|
||||||
if settings.get_settings("DEV_MODE"): jinja_environment.cache.clear()
|
if settings.get_settings("DEV_MODE"): jinja_environment.cache.clear()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user