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

Added exceptions to database

This commit is contained in:
krateng 2022-04-21 15:12:48 +02:00
parent ce495176c1
commit fbbd959295
2 changed files with 18 additions and 0 deletions

View File

@ -47,6 +47,14 @@ errors = {
'desc':"A scrobble requires these parameters."
}
}),
database.exceptions.EntityExists: lambda e: (409,{
"status":"failure",
"error":{
'type':'entity_exists',
'value':e.entitydict,
'desc':"This entity already exists in the database."
}
}),
Exception: lambda e: (500,{
"status":"failure",
"error":{

View File

@ -0,0 +1,10 @@
class EntityExists(Exception):
def __init__(self,entitydict):
self.entitydict = entitydict
class TrackExists(EntityExists):
pass
class ArtistExists(EntityExists):
pass