Improve failure devex (#2247)

This commit is contained in:
Suchintan
2025-04-30 13:21:10 -04:00
committed by GitHub
parent b55a5ee5f2
commit c069ebe6f9
5 changed files with 1127 additions and 1357 deletions

View File

@@ -674,6 +674,18 @@ class AgentDB:
LOG.error("UnexpectedError", exc_info=True)
raise
async def get_all_organizations(self) -> list[Organization]:
try:
async with self.Session() as session:
organizations = (await session.scalars(select(OrganizationModel))).all()
return [convert_to_organization(organization) for organization in organizations]
except SQLAlchemyError:
LOG.error("SQLAlchemyError", exc_info=True)
raise
except Exception:
LOG.error("UnexpectedError", exc_info=True)
raise
async def get_organization(self, organization_id: str) -> Organization | None:
try:
async with self.Session() as session: