Hello,
Problem, when exception raised in service with async_db_request_handler decorator, it return HTTPException, which FastAPI can't serialize and raised another exception
fastapi.exceptions.ResponseValidationError: 1 validation errors:
{'loc': ('response',), 'msg': 'value is not a valid dict', 'type': 'type_error.dict'}
code example:
Controller
@Get("/")
async def get_accounts(session: AsyncSession = Depends(config.get_db)):
return await self.service.get_list(session)
Service
@async_db_request_handler
async def get_list(self, session: AsyncSession):
query = select(Entity)
if True:
raise ValueError("ERROR")
result = await session.execute(query)
return result.scalars().all()
Maybe it should be raise HTTPException instead of return HTTPException?
code line
nest/core/decorators/database.py:82.
Hello,
Problem, when exception raised in service with async_db_request_handler decorator, it return HTTPException, which FastAPI can't serialize and raised another exception
code example:
Controller
Service
Maybe it should be raise HTTPException instead of return HTTPException?
code line
nest/core/decorators/database.py:82.