File tree Expand file tree Collapse file tree 4 files changed +9
-9
lines changed
payments/src/simcore_service_payments/db
web/server/src/simcore_service_webserver Expand file tree Collapse file tree 4 files changed +9
-9
lines changed Original file line number Diff line number Diff line change 11import datetime
22
3- import simcore_postgres_database .aiopg_errors as db_errors
43import sqlalchemy as sa
54from arrow import utcnow
65from models_library .api_schemas_payments .errors import (
1615 InitPromptAckFlowState ,
1716 payments_methods ,
1817)
18+ from sqlalchemy .exc import IntegrityError
1919
2020from ..models .db import PaymentsMethodsDB
2121from .base import BaseRepository
@@ -42,7 +42,7 @@ async def insert_init_payment_method(
4242 )
4343 return payment_method_id
4444
45- except db_errors . UniqueViolation as err :
45+ except IntegrityError as err :
4646 raise PaymentMethodUniqueViolationError (
4747 payment_method_id = payment_method_id
4848 ) from err
Original file line number Diff line number Diff line change 1313from models_library .users import UserID
1414from models_library .wallets import WalletID
1515from pydantic import HttpUrl , PositiveInt , TypeAdapter
16- from simcore_postgres_database import aiopg_errors as pg_errors
1716from simcore_postgres_database .models .payments_transactions import (
1817 PaymentTransactionState ,
1918 payments_transactions ,
2019)
20+ from sqlalchemy .exc import IntegrityError
2121
2222from ..models .db import PaymentsTransactionsDB
2323from .base import BaseRepository
@@ -58,7 +58,7 @@ async def insert_init_payment_transaction(
5858 )
5959 )
6060 return payment_id
61- except pg_errors . UniqueViolation as exc :
61+ except IntegrityError as exc :
6262 raise PaymentAlreadyExistsError (payment_id = f"{ payment_id } " ) from exc
6363
6464 async def update_ack_payment_transaction (
Original file line number Diff line number Diff line change 55from models_library .groups import Group , GroupID , GroupType
66from models_library .projects import ProjectID
77from models_library .users import UserID
8- from simcore_postgres_database .aiopg_errors import DatabaseError
8+ from simcore_postgres_database .aiopg_errors import DatabaseError as AiopgDatabaseError
9+ from sqlalchemy .exc import DatabaseError
910
1011from ..groups .api import get_group_by_gid
1112from ..projects ._projects_repository_legacy import (
@@ -187,8 +188,8 @@ async def replace_current_owner(
187188 )
188189
189190 except (
191+ AiopgDatabaseError ,
190192 DatabaseError ,
191- asyncpg .exceptions .PostgresError ,
192193 ProjectNotFoundError ,
193194 UserNotFoundError ,
194195 ):
Original file line number Diff line number Diff line change 1515from models_library .products import ProductName
1616from models_library .users import UserID
1717from servicelib .aiohttp .db_asyncpg_engine import get_async_engine
18- from simcore_postgres_database .aiopg_errors import DatabaseError as AiopgDatabaseError
19- from sqlalchemy .exc import DatabaseError as SQLAlchemyDatabaseError
18+ from sqlalchemy .exc import DatabaseError
2019
2120from . import _authz_repository
2221from ._authz_access_model import (
4847def _handle_exceptions_as_503 ():
4948 try :
5049 yield
51- except ( AiopgDatabaseError , SQLAlchemyDatabaseError ) as err :
50+ except DatabaseError as err :
5251 _logger .exception (
5352 ** create_troubleshooting_log_kwargs (
5453 "Auth unavailable due to database error" ,
You can’t perform that action at this time.
0 commit comments