Stumps.FallbackResponseHandler.FallbackResponseHandler C# (CSharp) Method

FallbackResponseHandler() public method

Initializes a new instance of the T:Stumps.FallbackResponseHandler class.
is null.
public FallbackResponseHandler ( FallbackResponse response ) : System
response FallbackResponse The default response.
return System
        public FallbackResponseHandler(FallbackResponse response)
        {

            if (!Enum.IsDefined(typeof(FallbackResponse), response))
            {
                throw new ArgumentOutOfRangeException("response");
            }

            // Fallback to 503 Service Unavailable when undefined
            response = response == FallbackResponse.Undefined ? FallbackResponse.Http503ServiceUnavailable : response;

            _statusCode = (int)response;
            _statusCodeDescription = HttpStatusCodes.GetStatusDescription(_statusCode);

            _origin = response == FallbackResponse.Http404NotFound
                          ? HttpResponseOrigin.NotFoundResponse
                          : HttpResponseOrigin.ServiceUnavailable;

        }