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:
parent
ce495176c1
commit
fbbd959295
@ -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":{
|
||||
|
10
maloja/database/exceptions.py
Normal file
10
maloja/database/exceptions.py
Normal file
@ -0,0 +1,10 @@
|
||||
class EntityExists(Exception):
|
||||
def __init__(self,entitydict):
|
||||
self.entitydict = entitydict
|
||||
|
||||
|
||||
class TrackExists(EntityExists):
|
||||
pass
|
||||
|
||||
class ArtistExists(EntityExists):
|
||||
pass
|
Loading…
Reference in New Issue
Block a user