mirror of
https://github.com/krateng/maloja.git
synced 2025-04-15 16:30:32 +03:00
Exceptions
This commit is contained in:
parent
abc48a04c8
commit
5524ee5aef
@ -72,6 +72,14 @@ errors = {
|
||||
'desc':"The database is being upgraded. Please try again later."
|
||||
}
|
||||
}),
|
||||
database.exceptions.EntityDoesNotExist: lambda e: (404,{
|
||||
"status":"error",
|
||||
"error":{
|
||||
'type':'entity_does_not_exist',
|
||||
'value':e.entitydict,
|
||||
'desc':"This entity does not exist in the database."
|
||||
}
|
||||
}),
|
||||
images.MalformedB64: lambda e: (400,{
|
||||
"status":"failure",
|
||||
"error":{
|
||||
|
@ -11,6 +11,8 @@ class TrackExists(EntityExists):
|
||||
class ArtistExists(EntityExists):
|
||||
pass
|
||||
|
||||
class AlbumExists(EntityExists):
|
||||
pass
|
||||
|
||||
class DatabaseNotBuilt(HTTPError):
|
||||
def __init__(self):
|
||||
@ -30,11 +32,11 @@ class MissingEntityParameter(Exception):
|
||||
|
||||
class EntityDoesNotExist(HTTPError):
|
||||
entitytype = 'Entity'
|
||||
def __init__(self,name):
|
||||
self.entityname = name
|
||||
def __init__(self,entitydict):
|
||||
self.entitydict = entitydict
|
||||
super().__init__(
|
||||
status=404,
|
||||
body=f"The {self.entitytype} '{self.entityname}' does not exist in the database."
|
||||
body=f"The {self.entitytype} '{self.entitydict}' does not exist in the database."
|
||||
)
|
||||
|
||||
class ArtistDoesNotExist(EntityDoesNotExist):
|
||||
|
Loading…
x
Reference in New Issue
Block a user