/// <summary> /// Initializes a new instance of the <see cref="RequestTrackingAttribute" /> class. /// </summary> /// <param name="trackedStatusCode">The HTTP response status code that should be tracked.</param> /// <exception cref="ArgumentException">Thrown when the <paramref name="trackedStatusCode"/> is outside the expected range (100-599).</exception> public RequestTrackingAttribute(int trackedStatusCode) { Guard.NotLessThan(trackedStatusCode, 100, nameof(trackedStatusCode), "Requires the allowed tracked HTTP status code to not be less than 100"); Guard.NotGreaterThan(trackedStatusCode, 599, nameof(trackedStatusCode), "Requires the allowed tracked HTTP status code to not be greater than 599"); StatusCodeRange = new StatusCodeRange(trackedStatusCode); }
/// <summary> /// Initializes a new instance of the <see cref="RequestTrackingAttribute" /> class. /// </summary> /// <param name="minimumStatusCode">The minimum HTTP status code threshold of the range of allowed tracked HTTP status codes.</param> /// <param name="maximumStatusCode">The maximum HTTP status code threshold of the range of allowed tracked HTTP status codes.</param> /// <exception cref="ArgumentOutOfRangeException"> /// Thrown when the <paramref name="minimumStatusCode"/> is less than 100, /// or the <paramref name="maximumStatusCode"/> is greater than 599, /// or the <paramref name="minimumStatusCode"/> is greater than the <paramref name="maximumStatusCode"/>. /// </exception> public RequestTrackingAttribute(int minimumStatusCode, int maximumStatusCode) { Guard.NotLessThan(minimumStatusCode, 100, nameof(minimumStatusCode), "Requires the minimum HTTP status code threshold not be less than 100"); Guard.NotGreaterThan(maximumStatusCode, 599, nameof(maximumStatusCode), "Requires the maximum HTTP status code threshold not be greater than 599"); Guard.NotGreaterThan(minimumStatusCode, maximumStatusCode, nameof(minimumStatusCode), "Requires the minimum HTTP status code threshold to be less than the maximum HTTP status code threshold"); StatusCodeRange = new StatusCodeRange(minimumStatusCode, maximumStatusCode); }