Skip to content

Commit 4e00de9

Browse files
committed
@sanderegg review: base api exception private
1 parent b7b35d1 commit 4e00de9

File tree

2 files changed

+17
-9
lines changed
  • packages/models-library/src/models_library/api_schemas_payments
  • services/payments/src/simcore_service_payments/core

2 files changed

+17
-9
lines changed

packages/models-library/src/models_library/api_schemas_payments/errors.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
from pydantic.errors import PydanticErrorMixin
22

33

4-
class BaseServiceError(PydanticErrorMixin, ValueError):
4+
class _BaseServiceApiError(PydanticErrorMixin, ValueError):
55
@classmethod
66
def get_full_class_name(cls) -> str:
77
# Can be used as unique code identifier
88
return f"{cls.__module__}.{cls.__name__}"
99

1010

1111
#
12-
# service wide errors
12+
# service-wide errors
1313
#
1414

1515

16-
class PaymentServiceUnavailableError(BaseServiceError):
16+
class PaymentServiceUnavailableError(_BaseServiceApiError):
1717
msg_template = "Payments are currently unavailable: {human_reason}"
1818

1919

2020
#
21-
# payments
21+
# payment transactions errors
2222
#
2323

2424

25-
class PaymentsError(BaseServiceError):
25+
class PaymentsError(_BaseServiceApiError):
2626
msg_template = "Error in payment transaction '{payment_id}'"
2727

2828

@@ -39,11 +39,11 @@ class PaymentAlreadyAckedError(PaymentsError):
3939

4040

4141
#
42-
# payment-methods
42+
# payment-methods errors
4343
#
4444

4545

46-
class PaymentsMethodsError(BaseServiceError):
46+
class PaymentsMethodsError(_BaseServiceApiError):
4747
...
4848

4949

services/payments/src/simcore_service_payments/core/errors.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1-
from models_library.api_schemas_payments.errors import BaseServiceError
1+
from pydantic.errors import PydanticErrorMixin
2+
3+
4+
class _BaseServiceInternalError(PydanticErrorMixin, ValueError):
5+
@classmethod
6+
def get_full_class_name(cls) -> str:
7+
# Can be used as unique code identifier
8+
return f"{cls.__module__}.{cls.__name__}"
9+
210

311
#
412
# gateway errors
513
#
614

715

8-
class PaymentsGatewayError(BaseServiceError):
16+
class PaymentsGatewayError(_BaseServiceInternalError):
917
...
1018

1119

0 commit comments

Comments
 (0)