forked from Dromaeosaur/MerchandiseCalendar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Exceptions.cs
79 lines (74 loc) · 2.76 KB
/
Exceptions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
using System;
namespace MerchandiseCalendar
{
/// <summary>
/// Exception thrown for invalid values of the merchandise week.
/// </summary>
public class InvalidMerchWeekException : Exception
{
/// <summary>
/// Exception thrown for invalid values of the merchandise week.
/// </summary>
/// <param name="week">
/// The value that caused the exception.
/// </param>
public InvalidMerchWeekException(int week) :
base("Merchandise week must be between 0 and 53. Week: " + week) { }
}
/// <summary>
/// Exception thrown for invalid values of the merchandise period.
/// </summary>
public class InvalidPeriodException : Exception
{
/// <summary>
/// Exception thrown for invalid values of the merchandise period.
/// </summary>
/// <param name="period">
/// The value that caused the exception.
/// </param>
public InvalidPeriodException(int period) :
base("Merchandise period must be between 1 and 12. Period: " + period) { }
}
/// <summary>
/// Exception thrown for invalid values of the merchandise season.
/// </summary>
public class InvalidSeasonException : Exception
{
/// <summary>
/// Exception thrown for invalid values of the merchandise season.
/// </summary>
/// <param name="season">
/// The value that caused the exception.
/// </param>
public InvalidSeasonException(string season) :
base("Merchandise season must be either Spring or Fall. Season: " + season) { }
}
/// <summary>
/// Exception thrown for invalid values of the merchandise quarter.
/// </summary>
public class InvalidQuarterException : Exception
{
/// <summary>
/// Exception thrown for invalid values of the merchandise quarter.
/// </summary>
/// <param name="quarter">
/// The value that caused the exception.
/// </param>
public InvalidQuarterException(int quarter) :
base("Quarter must be between 1 and 4. Quarter: " + quarter) { }
}
/// <summary>
/// Exception thrown for date ranges where the start date is after the end date.
/// </summary>
public class InvalidDateRangeException : Exception
{
/// <summary>
/// Exception thrown for date ranges where the start date is after the end date.
/// </summary>
/// <param name="dateRange">
/// the DateRange that caused the exception.
/// </param>
public InvalidDateRangeException(DateRange dateRange) :
base(String.Format("Start date must be before end date. Dates: {0} - {1}", dateRange.StartDate, dateRange.EndDate)) { }
}
}