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 CurrencyIsLimitException(string expectedCurrency) : base(
"CurrencyIsLimit",
$"Only the specified currency {expectedCurrency} is allowed.")
public CurrencyIsLimitException(string expectedCurrency) : base(OrdersErrorCodes.CurrencyIsLimit)
{
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 OrderLineInvalidQuantityException(Guid productId, Guid? productSkuId, int quantity) : base(
message: $"Invalid quantity {quantity} for product {productId} (SKU: {productSkuId}).")
public OrderLineInvalidQuantityException(Guid productId, Guid? productSkuId, int quantity) : base(OrdersErrorCodes.OrderLineInvalidQuantity)
{
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",
"OrderLineTotalDiscount": "Total discount",
"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
{
//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 DiscountAmountOverflowException()
: base("DiscountAmountOverflow", $"The discount amount overflow.")
public DiscountAmountOverflowException() : base(OrdersErrorCodes.DiscountAmountOverflow)
{
}
}

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 DuplicateOrderExtraFeeException(string extraFeeName, string extraFeeKey)
: base("DuplicateOrderExtraFee", $"The extra fee {extraFeeName} (key: {extraFeeKey}) is existed.")
public DuplicateOrderExtraFeeException(string extraFeeName, string extraFeeKey) : base(OrdersErrorCodes.DuplicateOrderExtraFee)
{
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 InvalidOrderExtraFeeException(decimal extraFee)
: base("InvalidExtraFee", $"The extra fee {extraFee} is invalid.")
public InvalidOrderExtraFeeException(decimal extraFee) : base(OrdersErrorCodes.InvalidOrderExtraFee)
{
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 InvalidPaymentException(Guid paymentId, Guid orderId)
: base(message: $"The payment {paymentId} has invalid configurations for the order {orderId}.")
public InvalidPaymentException(Guid paymentId, Guid orderId) : base(OrdersErrorCodes.InvalidPayment)
{
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 InvalidRefundAmountException(decimal amount)
: base("InvalidRefundAmount", $"The refund amount ({amount}) is invalid.")
public InvalidRefundAmountException(decimal amount) : base(OrdersErrorCodes.InvalidRefundAmount)
{
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 InvalidRefundQuantityException(int quantity)
: base("InvalidRefundQuantity", $"The refund quantity ({quantity}) is invalid.")
public InvalidRefundQuantityException(int quantity) : base(OrdersErrorCodes.InvalidRefundQuantity)
{
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 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 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 InvalidRefundQuantityException(int quantity)
: base("InvalidRefundQuantity", $"The refund quantity ({quantity}) is invalid.")
public InvalidRefundQuantityException(int quantity) : base(PaymentsErrorCodes.InvalidRefundQuantity)
{
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 OrderIsNotInSpecifiedPaymentException(Guid orderId, Guid paymentId)
: base("OrderIsNotInSpecifiedPayment", $"The order ({orderId}) is not in the specified payment ({paymentId}).")
public OrderIsNotInSpecifiedPaymentException(Guid orderId, Guid paymentId) : base(PaymentsErrorCodes.OrderIsNotInSpecifiedPayment)
{
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",
"PaymentItemStoreId": "Store ID",
"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
{
//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 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 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 NotAllowedToGetProductListWithShowHiddenException() : base(
message: $"You have no permission to get product list with hidden products.")
public NotAllowedToGetProductListWithShowHiddenException() : base(ProductsErrorCodes.NotAllowedToGetProductListWithShowHidden)
{
}
}

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 ProductAttributeOptionsDeletionFailedException() : base(
message: "Should ensure there are no SKUs using the attribute option which you want to delete.")
public ProductAttributeOptionsDeletionFailedException() : base(ProductsErrorCodes.ProductAttributeOptionsDeletionFailed)
{
}
}

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 ProductAttributesModificationFailedException() : base(
message: "Should ensure SKUs are empty if you want to modify attributes of a product.")
public ProductAttributesModificationFailedException() : base(ProductsErrorCodes.ProductAttributesModificationFailed)
{
}
}

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 StaticProductCannotBeModifiedException(Guid productId) : base(
message: $"Cannot modify the static product: {productId}")
public StaticProductCannotBeModifiedException(Guid productId) : base(ProductsErrorCodes.StaticProductCannotBeModified)
{
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 StoreIsNotProductOwnerException(Guid productId, Guid storeId) : base(
message: $"Store {storeId} is not a owner of the product {productId}")
public StoreIsNotProductOwnerException(Guid productId, Guid storeId) : base(ProductsErrorCodes.StoreIsNotProductOwner)
{
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 NotAllowedToGetCategoryListWithShowHiddenException() : base(
message: $"You have no permission to get category list with hidden categories.")
public NotAllowedToGetCategoryListWithShowHiddenException() : base(ProductsErrorCodes.NotAllowedToGetCategoryListWithShowHidden)
{
}
}

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

@ -83,12 +83,19 @@
"DecreaseInventory": "Decrease",
"ProductInventoryInventory": "Inventory",
"ChangeProductInventory": "Change inventory",
"EasyAbp.EShop.Products.ErrorCodes:DuplicateCategoryUniqueName": "The category unique name '{uniqueName}' is duplicated.",
"EasyAbp.EShop.Products.ErrorCodes: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.ErrorCodes:NonexistentProductGroup": "The specified product group ({productGroupName}) is nonexistent.",
"EasyAbp.EShop.Products.ErrorCodes:ProductDetailHasBeenUsed": "ProductDetail {productDetailId} has been used.",
"EasyAbp.EShop.Products.ErrorCodes: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:DuplicateCategoryUniqueName": "The category unique name '{uniqueName}' is duplicated.",
"EasyAbp.EShop.Products:DuplicatedProductUniqueName": "The product unique name '{uniqueName}' is duplicated.",
"EasyAbp.EShop.Products:InventoryChangeFailed": "Inventory of product {productId} (SKU: {productSkuId}) cannot be changed by {changedInventory} from {originalInventory}",
"EasyAbp.EShop.Products:NonexistentProductGroup": "The specified product group ({productGroupName}) is nonexistent.",
"EasyAbp.EShop.Products:ProductDetailHasBeenUsed": "ProductDetail {productDetailId} has been used.",
"EasyAbp.EShop.Products:ProductSkuCodeDuplicated": "Sku code {code} 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 InventoryInsufficientException(Guid productId, Guid productSkuId, int quantity, int inventory) : base(
message: $"The inventory of the product {productId} (SKU: {productSkuId}) is insufficient, {quantity} are needed, but only {inventory}.")
public InventoryInsufficientException(Guid productId, Guid productSkuId, int quantity, int inventory) : base(ProductsErrorCodes.InventoryInsufficient)
{
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 ProductSkuCodeDuplicated = "EasyAbp.EShop.Products:ProductSkuCodeDuplicated";
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 DuplicateCategoryUniqueNameException(string uniqueName) : base("DuplicateCategoryUniqueName")
public DuplicateCategoryUniqueNameException(string uniqueName) : base(ProductsErrorCodes.DuplicateCategoryUniqueName)
{
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 StoreOwnerDuplicatedException(Guid storeId, Guid ownerUserId) : base(
message: $"Owner {ownerUserId} is duplicate for the store {storeId}")
public StoreOwnerDuplicatedException(Guid storeId, Guid ownerUserId) : base(StoresErrorCodes.StoreOwnerDuplicated)
{
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",
"CreateTransaction": "New",
"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
{
//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 ProductSkuNotFoundException(Guid productId, Guid productSkuId) : base(
message: $"Product {productId} (SKU: {productSkuId}) not found.")
public ProductSkuNotFoundException(Guid productId, Guid productSkuId) : base(BasketsErrorCodes.ProductSkuNotFound)
{
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
{
//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",
"EditBasketItem": "Edit",
"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 EasyAbp.EShop.Plugins.Coupons;
namespace EasyAbp.EShop.Orders.Plugins.Coupons.OrderDiscount
{
public class CouponNotFoundOrHasExpiredException : BusinessException
{
public CouponNotFoundOrHasExpiredException() : base("CouponNotFoundOrHasExpired",
"Coupon not found or has expired.")
public CouponNotFoundOrHasExpiredException() : base(CouponsErrorCodes.CouponNotFoundOrHasExpired)
{
}
}

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 EasyAbp.EShop.Plugins.Coupons;
namespace EasyAbp.EShop.Orders.Plugins.Coupons.OrderDiscount
{
public class CouponTemplateNotFoundOrUnavailableException : BusinessException
{
public CouponTemplateNotFoundOrUnavailableException() : base("CouponTemplateNotFoundOrUnavailable",
"Coupon template not found or unavailable.")
public CouponTemplateNotFoundOrUnavailableException() : base(CouponsErrorCodes.CouponTemplateNotFoundOrUnavailable)
{
}
}

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 EasyAbp.EShop.Plugins.Coupons;
namespace EasyAbp.EShop.Orders.Plugins.Coupons.OrderDiscount
{
public class OrderDoesNotMeetCouponUsageConditionException : BusinessException
{
public OrderDoesNotMeetCouponUsageConditionException() : base("OrderDoesNotMeetCouponUsageCondition",
"Order does not meet the coupon usage condition.")
public OrderDoesNotMeetCouponUsageConditionException() : base(CouponsErrorCodes.OrderDoesNotMeetCouponUsageCondition)
{
}
}

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 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
{
//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",
"CreateCoupon": "New",
"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 InvalidCouponOrderIdException(Guid expectedOrderId, Guid? actualOrderId) : base("InvalidCouponOrderId",
$"The expected order ID is {expectedOrderId}, but the actual order ID is {actualOrderId}.")
public InvalidCouponOrderIdException(Guid expectedOrderId, Guid? actualOrderId) : base(CouponsErrorCodes.InvalidCouponOrderId)
{
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 UserCouponQuantityExceedsLimitException(int maxQuantity) : base("UserCouponQuantityExceedsLimit",
$"User's coupon quantity exceeds the limit: {maxQuantity}.")
public UserCouponQuantityExceedsLimitException(int maxQuantity) : base(CouponsErrorCodes.UserCouponQuantityExceedsLimit)
{
WithData(nameof(maxQuantity), maxQuantity);
}
}
}
Loading…
Cancel
Save