Browse Source

All exceptions are changed to ABP style

pull/122/head
SayHelloGsx 5 years ago
parent
commit
023857f0e4
  1. 5
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/CurrencyIsLimitException.cs
  2. 6
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/OrderLineInvalidQuantityException.cs
  3. 11
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/en.json
  4. 10
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/OrdersErrorCodes.cs
  5. 3
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/DiscountAmountOverflowException.cs
  6. 5
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/DuplicateOrderExtraFeeException.cs
  7. 4
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/InvalidOrderExtraFeeException.cs
  8. 5
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/InvalidPaymentException.cs
  9. 4
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/InvalidRefundAmountException.cs
  10. 4
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/InvalidRefundQuantityException.cs
  11. 3
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderIsInWrongStageException.cs
  12. 3
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Payments/MultiStorePaymentNotSupportedException.cs
  13. 4
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Refunds/InvalidRefundQuantityException.cs
  14. 5
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Refunds/OrderIsNotInSpecifiedPaymentException.cs
  15. 7
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Localization/Payments/en.json
  16. 6
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/PaymentsErrorCodes.cs
  17. 2
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/OrderIdNotFoundException.cs
  18. 2
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/StoreIdNotFoundException.cs
  19. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/NotAllowedToGetProductListWithShowHiddenException.cs
  20. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/ProductAttributeOptionsDeletionFailedException.cs
  21. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/ProductAttributesModificationFailedException.cs
  22. 4
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/StaticProductCannotBeModifiedException.cs
  23. 5
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/StoreIsNotProductOwnerException.cs
  24. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Categories/NotAllowedToGetCategoryListWithShowHiddenException.cs
  25. 21
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/en.json
  26. 7
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/ProductInventories/InventoryInsufficientException.cs
  27. 8
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/ProductsErrorCodes.cs
  28. 2
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Categories/DuplicateCategoryUniqueNameException.cs
  29. 5
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/StoreOwners/StoreOwnerDuplicatedException.cs
  30. 3
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/en.json
  31. 2
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/StoresErrorCodes.cs
  32. 5
      plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Application/EasyAbp/EShop/Plugins/Baskets/BasketItems/ProductSkuNotFoundException.cs
  33. 2
      plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Domain.Shared/EasyAbp/EShop/Plugins/Baskets/BasketsErrorCodes.cs
  34. 4
      plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Domain.Shared/EasyAbp/EShop/Plugins/Baskets/Localization/en.json
  35. 4
      plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/EasyAbp/EShop/Orders/Plugins/Coupons/OrderDiscount/CouponNotFoundOrHasExpiredException.cs
  36. 4
      plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/EasyAbp/EShop/Orders/Plugins/Coupons/OrderDiscount/CouponTemplateNotFoundOrUnavailableException.cs
  37. 4
      plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/EasyAbp/EShop/Orders/Plugins/Coupons/OrderDiscount/OrderDoesNotMeetCouponUsageConditionException.cs
  38. 2
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/Coupons/CouponHasBeenOccupiedException.cs
  39. 7
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/CouponsErrorCodes.cs
  40. 8
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/Localization/en.json
  41. 5
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain/EasyAbp/EShop/Plugins/Coupons/Coupons/InvalidCouponOrderIdException.cs
  42. 4
      plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.EntityFrameworkCore/EasyAbp/EShop/Plugins/Coupons/Coupons/UserCouponQuantityExceedsLimitException.cs

5
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/CurrencyIsLimitException.cs

@ -5,10 +5,9 @@ namespace EasyAbp.EShop.Orders.Orders
{ {
public class CurrencyIsLimitException : BusinessException public class CurrencyIsLimitException : BusinessException
{ {
public CurrencyIsLimitException(string expectedCurrency) : base( public CurrencyIsLimitException(string expectedCurrency) : base(OrdersErrorCodes.CurrencyIsLimit)
"CurrencyIsLimit",
$"Only the specified currency {expectedCurrency} is allowed.")
{ {
WithData(nameof(expectedCurrency), expectedCurrency);
} }
} }
} }

6
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/OrderLineInvalidQuantityException.cs

@ -5,9 +5,11 @@ namespace EasyAbp.EShop.Orders.Orders
{ {
public class OrderLineInvalidQuantityException : BusinessException public class OrderLineInvalidQuantityException : BusinessException
{ {
public OrderLineInvalidQuantityException(Guid productId, Guid? productSkuId, int quantity) : base( public OrderLineInvalidQuantityException(Guid productId, Guid? productSkuId, int quantity) : base(OrdersErrorCodes.OrderLineInvalidQuantity)
message: $"Invalid quantity {quantity} for product {productId} (SKU: {productSkuId}).")
{ {
WithData(nameof(productId), productId);
WithData(nameof(productSkuId), productSkuId);
WithData(nameof(quantity), quantity);
} }
} }
} }

11
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/en.json

@ -40,6 +40,15 @@
"OrderLineTotalPrice": "Total price", "OrderLineTotalPrice": "Total price",
"OrderLineTotalDiscount": "Total discount", "OrderLineTotalDiscount": "Total discount",
"OrderLineActualTotalPrice": "Actual total price", "OrderLineActualTotalPrice": "Actual total price",
"OrderLineQuantity": "Quantity" "OrderLineQuantity": "Quantity",
"EasyAbp.EShop.Orders:CurrencyIsLimit": "Only the specified currency {expectedCurrency} is allowed.",
"EasyAbp.EShop.Orders:OrderLineInvalidQuantity": "Invalid quantity {quantity} for product {productId} (SKU: {productSkuId}).",
"EasyAbp.EShop.Orders:DiscountAmountOverflow": "The discount amount overflow.",
"EasyAbp.EShop.Orders:DuplicateOrderExtraFee": "The extra fee {extraFeeName} (key: {extraFeeKey}) is existed.",
"EasyAbp.EShop.Orders:InvalidOrderExtraFee": "The extra fee {extraFee} is invalid.",
"EasyAbp.EShop.Orders:InvalidPayment": "The payment {paymentId} has invalid configurations for the order {orderId}.",
"EasyAbp.EShop.Orders:InvalidRefundAmount": "The refund amount ({amount}) is invalid.",
"EasyAbp.EShop.Orders:InvalidRefundQuantity": "The refund quantity ({quantity}) is invalid.",
"EasyAbp.EShop.Orders:OrderIsInWrongStage": "The order {orderId} is in the wrong stage."
} }
} }

10
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/OrdersErrorCodes.cs

@ -2,6 +2,14 @@
{ {
public static class OrdersErrorCodes public static class OrdersErrorCodes
{ {
//Add your business exception error codes here... public const string CurrencyIsLimit = "EasyAbp.EShop.Orders:CurrencyIsLimit";
public const string OrderLineInvalidQuantity = "EasyAbp.EShop.Orders:OrderLineInvalidQuantity";
public const string DiscountAmountOverflow = "EasyAbp.EShop.Orders:DiscountAmountOverflow";
public const string DuplicateOrderExtraFee = "EasyAbp.EShop.Orders:DuplicateOrderExtraFee";
public const string InvalidOrderExtraFee = "EasyAbp.EShop.Orders:InvalidOrderExtraFee";
public const string InvalidPayment = "EasyAbp.EShop.Orders:InvalidPayment";
public const string InvalidRefundAmount = "EasyAbp.EShop.Orders:InvalidRefundAmount";
public const string InvalidRefundQuantity = "EasyAbp.EShop.Orders:InvalidRefundQuantity";
public const string OrderIsInWrongStage = "EasyAbp.EShop.Orders:OrderIsInWrongStage";
} }
} }

3
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/DiscountAmountOverflowException.cs

@ -4,8 +4,7 @@ namespace EasyAbp.EShop.Orders.Orders
{ {
public class DiscountAmountOverflowException : BusinessException public class DiscountAmountOverflowException : BusinessException
{ {
public DiscountAmountOverflowException() public DiscountAmountOverflowException() : base(OrdersErrorCodes.DiscountAmountOverflow)
: base("DiscountAmountOverflow", $"The discount amount overflow.")
{ {
} }
} }

5
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/DuplicateOrderExtraFeeException.cs

@ -4,9 +4,10 @@ namespace EasyAbp.EShop.Orders.Orders
{ {
public class DuplicateOrderExtraFeeException : BusinessException public class DuplicateOrderExtraFeeException : BusinessException
{ {
public DuplicateOrderExtraFeeException(string extraFeeName, string extraFeeKey) public DuplicateOrderExtraFeeException(string extraFeeName, string extraFeeKey) : base(OrdersErrorCodes.DuplicateOrderExtraFee)
: base("DuplicateOrderExtraFee", $"The extra fee {extraFeeName} (key: {extraFeeKey}) is existed.")
{ {
WithData(nameof(extraFeeName), extraFeeName);
WithData(nameof(extraFeeKey), extraFeeKey);
} }
} }
} }

4
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/InvalidOrderExtraFeeException.cs

@ -4,9 +4,9 @@ namespace EasyAbp.EShop.Orders.Orders
{ {
public class InvalidOrderExtraFeeException : BusinessException public class InvalidOrderExtraFeeException : BusinessException
{ {
public InvalidOrderExtraFeeException(decimal extraFee) public InvalidOrderExtraFeeException(decimal extraFee) : base(OrdersErrorCodes.InvalidOrderExtraFee)
: base("InvalidExtraFee", $"The extra fee {extraFee} is invalid.")
{ {
WithData(nameof(extraFee), extraFee);
} }
} }
} }

5
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/InvalidPaymentException.cs

@ -5,9 +5,10 @@ namespace EasyAbp.EShop.Orders.Orders
{ {
public class InvalidPaymentException : BusinessException public class InvalidPaymentException : BusinessException
{ {
public InvalidPaymentException(Guid paymentId, Guid orderId) public InvalidPaymentException(Guid paymentId, Guid orderId) : base(OrdersErrorCodes.InvalidPayment)
: base(message: $"The payment {paymentId} has invalid configurations for the order {orderId}.")
{ {
WithData(nameof(paymentId), paymentId);
WithData(nameof(orderId), orderId);
} }
} }
} }

4
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/InvalidRefundAmountException.cs

@ -4,9 +4,9 @@ namespace EasyAbp.EShop.Orders.Orders
{ {
public class InvalidRefundAmountException : BusinessException public class InvalidRefundAmountException : BusinessException
{ {
public InvalidRefundAmountException(decimal amount) public InvalidRefundAmountException(decimal amount) : base(OrdersErrorCodes.InvalidRefundAmount)
: base("InvalidRefundAmount", $"The refund amount ({amount}) is invalid.")
{ {
WithData(nameof(amount), amount);
} }
} }
} }

4
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/InvalidRefundQuantityException.cs

@ -4,9 +4,9 @@ namespace EasyAbp.EShop.Orders.Orders
{ {
public class InvalidRefundQuantityException : BusinessException public class InvalidRefundQuantityException : BusinessException
{ {
public InvalidRefundQuantityException(int quantity) public InvalidRefundQuantityException(int quantity) : base(OrdersErrorCodes.InvalidRefundQuantity)
: base("InvalidRefundQuantity", $"The refund quantity ({quantity}) is invalid.")
{ {
WithData(nameof(quantity), quantity);
} }
} }
} }

3
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderIsInWrongStageException.cs

@ -5,8 +5,9 @@ namespace EasyAbp.EShop.Orders.Orders
{ {
public class OrderIsInWrongStageException : BusinessException public class OrderIsInWrongStageException : BusinessException
{ {
public OrderIsInWrongStageException(Guid orderId) : base(message: $"The order {orderId} is in the wrong stage.") public OrderIsInWrongStageException(Guid orderId) : base(OrdersErrorCodes.OrderIsInWrongStage)
{ {
WithData(nameof(orderId), orderId);
} }
} }
} }

3
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Payments/MultiStorePaymentNotSupportedException.cs

@ -4,9 +4,8 @@ namespace EasyAbp.EShop.Payments.Payments
{ {
public class MultiStorePaymentNotSupportedException : BusinessException public class MultiStorePaymentNotSupportedException : BusinessException
{ {
public MultiStorePaymentNotSupportedException() : base(message: $"Should create payments for each store.") public MultiStorePaymentNotSupportedException() : base(PaymentsErrorCodes.MultiStorePaymentNotSupported)
{ {
} }
} }
} }

4
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Refunds/InvalidRefundQuantityException.cs

@ -4,9 +4,9 @@ namespace EasyAbp.EShop.Payments.Refunds
{ {
public class InvalidRefundQuantityException : BusinessException public class InvalidRefundQuantityException : BusinessException
{ {
public InvalidRefundQuantityException(int quantity) public InvalidRefundQuantityException(int quantity) : base(PaymentsErrorCodes.InvalidRefundQuantity)
: base("InvalidRefundQuantity", $"The refund quantity ({quantity}) is invalid.")
{ {
WithData(nameof(quantity), quantity);
} }
} }
} }

5
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Refunds/OrderIsNotInSpecifiedPaymentException.cs

@ -5,9 +5,10 @@ namespace EasyAbp.EShop.Payments.Refunds
{ {
public class OrderIsNotInSpecifiedPaymentException : BusinessException public class OrderIsNotInSpecifiedPaymentException : BusinessException
{ {
public OrderIsNotInSpecifiedPaymentException(Guid orderId, Guid paymentId) public OrderIsNotInSpecifiedPaymentException(Guid orderId, Guid paymentId) : base(PaymentsErrorCodes.OrderIsNotInSpecifiedPayment)
: base("OrderIsNotInSpecifiedPayment", $"The order ({orderId}) is not in the specified payment ({paymentId}).")
{ {
WithData(nameof(orderId), orderId);
WithData(nameof(paymentId), paymentId);
} }
} }
} }

7
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Localization/Payments/en.json

@ -7,6 +7,11 @@
"Permission:Payments": "Payment", "Permission:Payments": "Payment",
"PaymentItemStoreId": "Store ID", "PaymentItemStoreId": "Store ID",
"Permission:Refunds": "Refund", "Permission:Refunds": "Refund",
"RefundItemStoreId": "Store ID" "RefundItemStoreId": "Store ID",
"EasyAbp.EShop.Payments:MultiStorePaymentNotSupported": "Should create payments for each store.",
"EasyAbp.EShop.Payments:InvalidRefundQuantity": "The refund quantity ({quantity}) is invalid.",
"EasyAbp.EShop.Payments:OrderIsNotInSpecifiedPayment": "The order ({orderId}) is not in the specified payment ({paymentId}).",
"EasyAbp.EShop.Payments:OrderIdNotFound": "Cannot get valid OrderId from ExtraProperties.",
"EasyAbp.EShop.Payments:StoreIdNotFound": "Cannot get valid StoreId from ExtraProperties.",
} }
} }

6
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/PaymentsErrorCodes.cs

@ -2,6 +2,10 @@
{ {
public static class PaymentsErrorCodes public static class PaymentsErrorCodes
{ {
//Add your business exception error codes here... public const string MultiStorePaymentNotSupported = "EasyAbp.EShop.Payments:MultiStorePaymentNotSupported";
public const string InvalidRefundQuantity = "EasyAbp.EShop.Payments:InvalidRefundQuantity";
public const string OrderIsNotInSpecifiedPayment = "EasyAbp.EShop.Payments:OrderIsNotInSpecifiedPayment";
public const string OrderIdNotFound = "EasyAbp.EShop.Payments:OrderIdNotFound";
public const string StoreIdNotFound = "EasyAbp.EShop.Payments:StoreIdNotFound";
} }
} }

2
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/OrderIdNotFoundException.cs

@ -4,7 +4,7 @@ namespace EasyAbp.EShop.Payments
{ {
public class OrderIdNotFoundException : BusinessException public class OrderIdNotFoundException : BusinessException
{ {
public OrderIdNotFoundException() : base(message: $"Cannot get valid OrderId from ExtraProperties.") public OrderIdNotFoundException() : base(PaymentsErrorCodes.OrderIdNotFound)
{ {
} }
} }

2
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/StoreIdNotFoundException.cs

@ -4,7 +4,7 @@ namespace EasyAbp.EShop.Payments
{ {
public class StoreIdNotFoundException : BusinessException public class StoreIdNotFoundException : BusinessException
{ {
public StoreIdNotFoundException() : base(message: $"Cannot get valid StoreId from ExtraProperties.") public StoreIdNotFoundException() : base(PaymentsErrorCodes.StoreIdNotFound)
{ {
} }
} }

3
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/NotAllowedToGetProductListWithShowHiddenException.cs

@ -5,8 +5,7 @@ namespace EasyAbp.EShop.Products.Products
{ {
public class NotAllowedToGetProductListWithShowHiddenException : BusinessException public class NotAllowedToGetProductListWithShowHiddenException : BusinessException
{ {
public NotAllowedToGetProductListWithShowHiddenException() : base( public NotAllowedToGetProductListWithShowHiddenException() : base(ProductsErrorCodes.NotAllowedToGetProductListWithShowHidden)
message: $"You have no permission to get product list with hidden products.")
{ {
} }
} }

3
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/ProductAttributeOptionsDeletionFailedException.cs

@ -5,8 +5,7 @@ namespace EasyAbp.EShop.Products.Products
{ {
public class ProductAttributeOptionsDeletionFailedException : BusinessException public class ProductAttributeOptionsDeletionFailedException : BusinessException
{ {
public ProductAttributeOptionsDeletionFailedException() : base( public ProductAttributeOptionsDeletionFailedException() : base(ProductsErrorCodes.ProductAttributeOptionsDeletionFailed)
message: "Should ensure there are no SKUs using the attribute option which you want to delete.")
{ {
} }
} }

3
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/ProductAttributesModificationFailedException.cs

@ -5,8 +5,7 @@ namespace EasyAbp.EShop.Products.Products
{ {
public class ProductAttributesModificationFailedException : BusinessException public class ProductAttributesModificationFailedException : BusinessException
{ {
public ProductAttributesModificationFailedException() : base( public ProductAttributesModificationFailedException() : base(ProductsErrorCodes.ProductAttributesModificationFailed)
message: "Should ensure SKUs are empty if you want to modify attributes of a product.")
{ {
} }
} }

4
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/StaticProductCannotBeModifiedException.cs

@ -5,9 +5,9 @@ namespace EasyAbp.EShop.Products.Products
{ {
public class StaticProductCannotBeModifiedException : BusinessException public class StaticProductCannotBeModifiedException : BusinessException
{ {
public StaticProductCannotBeModifiedException(Guid productId) : base( public StaticProductCannotBeModifiedException(Guid productId) : base(ProductsErrorCodes.StaticProductCannotBeModified)
message: $"Cannot modify the static product: {productId}")
{ {
WithData(nameof(productId), productId);
} }
} }
} }

5
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/StoreIsNotProductOwnerException.cs

@ -5,9 +5,10 @@ namespace EasyAbp.EShop.Products.Products
{ {
public class StoreIsNotProductOwnerException : BusinessException public class StoreIsNotProductOwnerException : BusinessException
{ {
public StoreIsNotProductOwnerException(Guid productId, Guid storeId) : base( public StoreIsNotProductOwnerException(Guid productId, Guid storeId) : base(ProductsErrorCodes.StoreIsNotProductOwner)
message: $"Store {storeId} is not a owner of the product {productId}")
{ {
WithData(nameof(productId), productId);
WithData(nameof(storeId), storeId);
} }
} }
} }

3
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Categories/NotAllowedToGetCategoryListWithShowHiddenException.cs

@ -4,8 +4,7 @@ namespace EasyAbp.EShop.Products.Categories
{ {
public class NotAllowedToGetCategoryListWithShowHiddenException : BusinessException public class NotAllowedToGetCategoryListWithShowHiddenException : BusinessException
{ {
public NotAllowedToGetCategoryListWithShowHiddenException() : base( public NotAllowedToGetCategoryListWithShowHiddenException() : base(ProductsErrorCodes.NotAllowedToGetCategoryListWithShowHidden)
message: $"You have no permission to get category list with hidden categories.")
{ {
} }
} }

21
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/en.json

@ -83,12 +83,19 @@
"DecreaseInventory": "Decrease", "DecreaseInventory": "Decrease",
"ProductInventoryInventory": "Inventory", "ProductInventoryInventory": "Inventory",
"ChangeProductInventory": "Change inventory", "ChangeProductInventory": "Change inventory",
"EasyAbp.EShop.Products.ErrorCodes:DuplicateCategoryUniqueName": "The category unique name '{uniqueName}' is duplicated.", "EasyAbp.EShop.Products:DuplicateCategoryUniqueName": "The category unique name '{uniqueName}' is duplicated.",
"EasyAbp.EShop.Products.ErrorCodes:DuplicatedProductUniqueName": "The product unique name '{uniqueName}' is duplicated.", "EasyAbp.EShop.Products:DuplicatedProductUniqueName": "The product unique name '{uniqueName}' is duplicated.",
"EasyAbp.EShop.Products.ErrorCodes:InventoryChangeFailed": "Inventory of product {productId} (SKU: {productSkuId}) cannot be changed by {changedInventory} from {originalInventory}", "EasyAbp.EShop.Products:InventoryChangeFailed": "Inventory of product {productId} (SKU: {productSkuId}) cannot be changed by {changedInventory} from {originalInventory}",
"EasyAbp.EShop.Products.ErrorCodes:NonexistentProductGroup": "The specified product group ({productGroupName}) is nonexistent.", "EasyAbp.EShop.Products:NonexistentProductGroup": "The specified product group ({productGroupName}) is nonexistent.",
"EasyAbp.EShop.Products.ErrorCodes:ProductDetailHasBeenUsed": "ProductDetail {productDetailId} has been used.", "EasyAbp.EShop.Products:ProductDetailHasBeenUsed": "ProductDetail {productDetailId} has been used.",
"EasyAbp.EShop.Products.ErrorCodes:ProductSkuCodeDuplicated": "Sku code {code} is duplicate for the product {productId}", "EasyAbp.EShop.Products:ProductSkuCodeDuplicated": "Sku code {code} is duplicate for the product {productId}",
"EasyAbp.EShop.Products.ErrorCodes:ProductSkuDuplicated": "Sku {serializedAttributeOptionIds} is duplicate for the product {productId}" "EasyAbp.EShop.Products:ProductSkuDuplicated": "Sku {serializedAttributeOptionIds} is duplicate for the product {productId}",
"EasyAbp.EShop.Products:NotAllowedToGetCategoryListWithShowHidden": "You have no permission to get category list with hidden categories.",
"EasyAbp.EShop.Products:NotAllowedToGetProductListWithShowHidden": "You have no permission to get product list with hidden products.",
"EasyAbp.EShop.Products:ProductAttributeOptionsDeletionFailed": "Should ensure there are no SKUs using the attribute option which you want to delete.",
"EasyAbp.EShop.Products:ProductAttributesModificationFailed": "Should ensure SKUs are empty if you want to modify attributes of a product.",
"EasyAbp.EShop.Products:StaticProductCannotBeModified": "Cannot modify the static product: {productId}",
"EasyAbp.EShop.Products:StoreIsNotProductOwner": "Store {storeId} is not a owner of the product {productId}",
"EasyAbp.EShop.Products:InventoryInsufficient": "The inventory of the product {productId} (SKU: {productSkuId}) is insufficient, {quantity} are needed, but only {inventory}."
} }
} }

7
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/ProductInventories/InventoryInsufficientException.cs

@ -5,9 +5,12 @@ namespace EasyAbp.EShop.Products.ProductInventories
{ {
public class InventoryInsufficientException : BusinessException public class InventoryInsufficientException : BusinessException
{ {
public InventoryInsufficientException(Guid productId, Guid productSkuId, int quantity, int inventory) : base( public InventoryInsufficientException(Guid productId, Guid productSkuId, int quantity, int inventory) : base(ProductsErrorCodes.InventoryInsufficient)
message: $"The inventory of the product {productId} (SKU: {productSkuId}) is insufficient, {quantity} are needed, but only {inventory}.")
{ {
WithData(nameof(productId), productId);
WithData(nameof(productSkuId), productSkuId);
WithData(nameof(quantity), quantity);
WithData(nameof(inventory), inventory);
} }
} }
} }

8
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/ProductsErrorCodes.cs

@ -9,6 +9,12 @@
public const string ProductDetailHasBeenUsed = "EasyAbp.EShop.Products:ProductDetailHasBeenUsed"; public const string ProductDetailHasBeenUsed = "EasyAbp.EShop.Products:ProductDetailHasBeenUsed";
public const string ProductSkuCodeDuplicated = "EasyAbp.EShop.Products:ProductSkuCodeDuplicated"; public const string ProductSkuCodeDuplicated = "EasyAbp.EShop.Products:ProductSkuCodeDuplicated";
public const string ProductSkuDuplicated = "EasyAbp.EShop.Products:ProductSkuDuplicated"; public const string ProductSkuDuplicated = "EasyAbp.EShop.Products:ProductSkuDuplicated";
//Add your business exception error codes here... public const string NotAllowedToGetCategoryListWithShowHidden = "EasyAbp.EShop.Products:NotAllowedToGetCategoryListWithShowHidden";
public const string NotAllowedToGetProductListWithShowHidden = "EasyAbp.EShop.Products:NotAllowedToGetProductListWithShowHidden";
public const string ProductAttributeOptionsDeletionFailed = "EasyAbp.EShop.Products:ProductAttributeOptionsDeletionFailed";
public const string ProductAttributesModificationFailed = "EasyAbp.EShop.Products:ProductAttributesModificationFailed";
public const string StaticProductCannotBeModified = "EasyAbp.EShop.Products:StaticProductCannotBeModified";
public const string StoreIsNotProductOwner = "EasyAbp.EShop.Products:StoreIsNotProductOwner";
public const string InventoryInsufficient = "EasyAbp.EShop.Products:InventoryInsufficient";
} }
} }

2
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Categories/DuplicateCategoryUniqueNameException.cs

@ -4,7 +4,7 @@ namespace EasyAbp.EShop.Products.Categories
{ {
public class DuplicateCategoryUniqueNameException : BusinessException public class DuplicateCategoryUniqueNameException : BusinessException
{ {
public DuplicateCategoryUniqueNameException(string uniqueName) : base("DuplicateCategoryUniqueName") public DuplicateCategoryUniqueNameException(string uniqueName) : base(ProductsErrorCodes.DuplicateCategoryUniqueName)
{ {
WithData(nameof(uniqueName), uniqueName); WithData(nameof(uniqueName), uniqueName);
} }

5
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/StoreOwners/StoreOwnerDuplicatedException.cs

@ -5,9 +5,10 @@ namespace EasyAbp.EShop.Stores.StoreOwners
{ {
public class StoreOwnerDuplicatedException : BusinessException public class StoreOwnerDuplicatedException : BusinessException
{ {
public StoreOwnerDuplicatedException(Guid storeId, Guid ownerUserId) : base( public StoreOwnerDuplicatedException(Guid storeId, Guid ownerUserId) : base(StoresErrorCodes.StoreOwnerDuplicated)
message: $"Owner {ownerUserId} is duplicate for the store {storeId}")
{ {
WithData(nameof(storeId), storeId);
WithData(nameof(ownerUserId), ownerUserId);
} }
} }
} }

3
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/en.json

@ -34,6 +34,7 @@
"TransactionAmount": "Amount", "TransactionAmount": "Amount",
"CreateTransaction": "New", "CreateTransaction": "New",
"EditTransaction": "Edit", "EditTransaction": "Edit",
"TransactionDeletionConfirmationMessage": "Are you sure to delete the transaction {0}?" "TransactionDeletionConfirmationMessage": "Are you sure to delete the transaction {0}?",
"EasyAbp.EShop.Stores:StoreOwnerDuplicated": "Owner {ownerUserId} is duplicate for the store {storeId}."
} }
} }

2
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/StoresErrorCodes.cs

@ -2,6 +2,6 @@
{ {
public static class StoresErrorCodes public static class StoresErrorCodes
{ {
//Add your business exception error codes here... public const string StoreOwnerDuplicated = "EasyAbp.EShop.Stores:StoreOwnerDuplicated";
} }
} }

5
plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Application/EasyAbp/EShop/Plugins/Baskets/BasketItems/ProductSkuNotFoundException.cs

@ -5,9 +5,10 @@ namespace EasyAbp.EShop.Plugins.Baskets.BasketItems
{ {
public class ProductSkuNotFoundException : BusinessException public class ProductSkuNotFoundException : BusinessException
{ {
public ProductSkuNotFoundException(Guid productId, Guid productSkuId) : base( public ProductSkuNotFoundException(Guid productId, Guid productSkuId) : base(BasketsErrorCodes.ProductSkuNotFound)
message: $"Product {productId} (SKU: {productSkuId}) not found.")
{ {
WithData(nameof(productId), productId);
WithData(nameof(productSkuId), productSkuId);
} }
} }
} }

2
plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Domain.Shared/EasyAbp/EShop/Plugins/Baskets/BasketsErrorCodes.cs

@ -2,6 +2,6 @@
{ {
public static class BasketsErrorCodes public static class BasketsErrorCodes
{ {
//Add your business exception error codes here... public const string ProductSkuNotFound = "EasyAbp.EShop.Plugins.Baskets:ProductSkuNotFound";
} }
} }

4
plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Domain.Shared/EasyAbp/EShop/Plugins/Baskets/Localization/en.json

@ -27,6 +27,8 @@
"CreateBasketItem": "New", "CreateBasketItem": "New",
"EditBasketItem": "Edit", "EditBasketItem": "Edit",
"BasketItemDeletionConfirmationMessage": "Are you sure to delete the basket item {0}?", "BasketItemDeletionConfirmationMessage": "Are you sure to delete the basket item {0}?",
"SuccessfullyDeleted": "Successfully deleted" "SuccessfullyDeleted": "Successfully deleted",
"EasyAbp.EShop.Plugins.Baskets:ProductSkuNotFound": "Product {productId} (SKU: {productSkuId}) not found.",
} }
} }

4
plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/EasyAbp/EShop/Orders/Plugins/Coupons/OrderDiscount/CouponNotFoundOrHasExpiredException.cs

@ -1,11 +1,11 @@
using Volo.Abp; using Volo.Abp;
using EasyAbp.EShop.Plugins.Coupons;
namespace EasyAbp.EShop.Orders.Plugins.Coupons.OrderDiscount namespace EasyAbp.EShop.Orders.Plugins.Coupons.OrderDiscount
{ {
public class CouponNotFoundOrHasExpiredException : BusinessException public class CouponNotFoundOrHasExpiredException : BusinessException
{ {
public CouponNotFoundOrHasExpiredException() : base("CouponNotFoundOrHasExpired", public CouponNotFoundOrHasExpiredException() : base(CouponsErrorCodes.CouponNotFoundOrHasExpired)
"Coupon not found or has expired.")
{ {
} }
} }

4
plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/EasyAbp/EShop/Orders/Plugins/Coupons/OrderDiscount/CouponTemplateNotFoundOrUnavailableException.cs

@ -1,11 +1,11 @@
using Volo.Abp; using Volo.Abp;
using EasyAbp.EShop.Plugins.Coupons;
namespace EasyAbp.EShop.Orders.Plugins.Coupons.OrderDiscount namespace EasyAbp.EShop.Orders.Plugins.Coupons.OrderDiscount
{ {
public class CouponTemplateNotFoundOrUnavailableException : BusinessException public class CouponTemplateNotFoundOrUnavailableException : BusinessException
{ {
public CouponTemplateNotFoundOrUnavailableException() : base("CouponTemplateNotFoundOrUnavailable", public CouponTemplateNotFoundOrUnavailableException() : base(CouponsErrorCodes.CouponTemplateNotFoundOrUnavailable)
"Coupon template not found or unavailable.")
{ {
} }
} }

4
plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/EasyAbp/EShop/Orders/Plugins/Coupons/OrderDiscount/OrderDoesNotMeetCouponUsageConditionException.cs

@ -1,11 +1,11 @@
using Volo.Abp; using Volo.Abp;
using EasyAbp.EShop.Plugins.Coupons;
namespace EasyAbp.EShop.Orders.Plugins.Coupons.OrderDiscount namespace EasyAbp.EShop.Orders.Plugins.Coupons.OrderDiscount
{ {
public class OrderDoesNotMeetCouponUsageConditionException : BusinessException public class OrderDoesNotMeetCouponUsageConditionException : BusinessException
{ {
public OrderDoesNotMeetCouponUsageConditionException() : base("OrderDoesNotMeetCouponUsageCondition", public OrderDoesNotMeetCouponUsageConditionException() : base(CouponsErrorCodes.OrderDoesNotMeetCouponUsageCondition)
"Order does not meet the coupon usage condition.")
{ {
} }
} }

2
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/Coupons/CouponHasBeenOccupiedException.cs

@ -4,7 +4,7 @@ namespace EasyAbp.EShop.Plugins.Coupons.Coupons
{ {
public class CouponHasBeenOccupiedException : BusinessException public class CouponHasBeenOccupiedException : BusinessException
{ {
public CouponHasBeenOccupiedException() : base("CouponHasBeenOccupied", "Coupon has been occupied.") public CouponHasBeenOccupiedException() : base(CouponsErrorCodes.CouponHasBeenOccupied)
{ {
} }
} }

7
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/CouponsErrorCodes.cs

@ -2,6 +2,11 @@
{ {
public static class CouponsErrorCodes public static class CouponsErrorCodes
{ {
//Add your business exception error codes here... public const string CouponNotFoundOrHasExpired = "EasyAbp.EShop.Plugins.Coupons:CouponNotFoundOrHasExpired";
public const string CouponTemplateNotFoundOrUnavailable = "EasyAbp.EShop.Plugins.Coupons:CouponTemplateNotFoundOrUnavailable";
public const string OrderDoesNotMeetCouponUsageCondition = "EasyAbp.EShop.Plugins.Coupons:OrderDoesNotMeetCouponUsageCondition";
public const string CouponHasBeenOccupied = "EasyAbp.EShop.Plugins.Coupons:CouponHasBeenOccupied";
public const string InvalidCouponOrderId = "EasyAbp.EShop.Plugins.Coupons:InvalidCouponOrderId";
public const string UserCouponQuantityExceedsLimit = "EasyAbp.EShop.Plugins.Coupons:UserCouponQuantityExceedsLimit";
} }
} }

8
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/Localization/en.json

@ -48,6 +48,12 @@
"CouponDiscountedAmount": "Discounted amount", "CouponDiscountedAmount": "Discounted amount",
"CreateCoupon": "New", "CreateCoupon": "New",
"EditCoupon": "Edit", "EditCoupon": "Edit",
"CouponDeletionConfirmationMessage": "Are you sure to delete the coupon {0}?" "CouponDeletionConfirmationMessage": "Are you sure to delete the coupon {0}?",
"EasyAbp.EShop.Plugins.Coupons:CouponNotFoundOrHasExpired": "Coupon not found or has expired.",
"EasyAbp.EShop.Plugins.Coupons:CouponTemplateNotFoundOrUnavailable": "Coupon template not found or unavailable.",
"EasyAbp.EShop.Plugins.Coupons:OrderDoesNotMeetCouponUsageCondition": "Order does not meet the coupon usage condition.",
"EasyAbp.EShop.Plugins.Coupons:CouponHasBeenOccupied": "Coupon has been occupied.",
"EasyAbp.EShop.Plugins.Coupons:InvalidCouponOrderId": "The expected order ID is {expectedOrderId}, but the actual order ID is {actualOrderId}.",
"EasyAbp.EShop.Plugins.Coupons:UserCouponQuantityExceedsLimit": "User's coupon quantity exceeds the limit: {maxQuantity}."
} }
} }

5
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain/EasyAbp/EShop/Plugins/Coupons/Coupons/InvalidCouponOrderIdException.cs

@ -5,9 +5,10 @@ namespace EasyAbp.EShop.Plugins.Coupons.Coupons
{ {
public class InvalidCouponOrderIdException : BusinessException public class InvalidCouponOrderIdException : BusinessException
{ {
public InvalidCouponOrderIdException(Guid expectedOrderId, Guid? actualOrderId) : base("InvalidCouponOrderId", public InvalidCouponOrderIdException(Guid expectedOrderId, Guid? actualOrderId) : base(CouponsErrorCodes.InvalidCouponOrderId)
$"The expected order ID is {expectedOrderId}, but the actual order ID is {actualOrderId}.")
{ {
WithData(nameof(expectedOrderId), expectedOrderId);
WithData(nameof(actualOrderId), actualOrderId);
} }
} }
} }

4
plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.EntityFrameworkCore/EasyAbp/EShop/Plugins/Coupons/Coupons/UserCouponQuantityExceedsLimitException.cs

@ -4,9 +4,9 @@ namespace EasyAbp.EShop.Plugins.Coupons.Coupons
{ {
public class UserCouponQuantityExceedsLimitException : BusinessException public class UserCouponQuantityExceedsLimitException : BusinessException
{ {
public UserCouponQuantityExceedsLimitException(int maxQuantity) : base("UserCouponQuantityExceedsLimit", public UserCouponQuantityExceedsLimitException(int maxQuantity) : base(CouponsErrorCodes.UserCouponQuantityExceedsLimit)
$"User's coupon quantity exceeds the limit: {maxQuantity}.")
{ {
WithData(nameof(maxQuantity), maxQuantity);
} }
} }
} }
Loading…
Cancel
Save