Reason Property in ConstraintViolationException
The exception ConstraintViolationException has been enhanced with the Reason property to provide details on the reason for the constraint violation.
Reasons for Violations
- ProductExcludedFromMenu - product is excluded from the menu
- ModifierUsing - incorrect use of modifiers
- PaymentTypeUsing - issues with payment type
- CommodityMarkUsing - incorrect quantity of marking
- SettingsIssue - issues in settings
Example Usage
try
{
// Order operation
}
catch (ConstraintViolationException ex)
{
switch (ex.Reason)
{
case ConstraintViolationReason.ProductExcludedFromMenu:
// Handling excluded product from menu
break;
case ConstraintViolationReason.ModifierUsing:
// Handling errors with modifiers
break;
}
}