This commit is contained in:
Jakub Miazek
2023-04-10 21:42:13 +02:00
parent aa1b9ec867
commit ee1d241d23
5 changed files with 21 additions and 34 deletions

View File

@@ -38,9 +38,7 @@ class Base:
db_session.add(self)
return await db_session.commit()
except SQLAlchemyError as ex:
raise HTTPException(
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY, detail=repr(ex)
) from ex
raise HTTPException(status_code=status.HTTP_422_UNPROCESSABLE_ENTITY, detail=repr(ex)) from ex
async def delete(self, db_session: AsyncSession):
"""
@@ -53,9 +51,7 @@ class Base:
await db_session.commit()
return True
except SQLAlchemyError as ex:
raise HTTPException(
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY, detail=repr(ex)
) from ex
raise HTTPException(status_code=status.HTTP_422_UNPROCESSABLE_ENTITY, detail=repr(ex)) from ex
async def update(self, db_session: AsyncSession, **kwargs):
"""