mirror of
https://github.com/krateng/maloja.git
synced 2025-07-09 03:04:07 -04: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."
|
'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,{
|
images.MalformedB64: lambda e: (400,{
|
||||||
"status":"failure",
|
"status":"failure",
|
||||||
"error":{
|
"error":{
|
||||||
|
@ -11,6 +11,8 @@ class TrackExists(EntityExists):
|
|||||||
class ArtistExists(EntityExists):
|
class ArtistExists(EntityExists):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
class AlbumExists(EntityExists):
|
||||||
|
pass
|
||||||
|
|
||||||
class DatabaseNotBuilt(HTTPError):
|
class DatabaseNotBuilt(HTTPError):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -30,11 +32,11 @@ class MissingEntityParameter(Exception):
|
|||||||
|
|
||||||
class EntityDoesNotExist(HTTPError):
|
class EntityDoesNotExist(HTTPError):
|
||||||
entitytype = 'Entity'
|
entitytype = 'Entity'
|
||||||
def __init__(self,name):
|
def __init__(self,entitydict):
|
||||||
self.entityname = name
|
self.entitydict = entitydict
|
||||||
super().__init__(
|
super().__init__(
|
||||||
status=404,
|
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):
|
class ArtistDoesNotExist(EntityDoesNotExist):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user