예제 #1
0
        private static Response CreateNegotiatedResponse(NancyContext context, IResponseNegotiator responseNegotiator, Exception exception)
        {
            HttpServiceError httpServiceError = HttpServiceErrorUtilities.ExtractFromException(exception, HttpServiceErrorDefinition.GeneralError);

            Negotiator negotiator = new Negotiator(context)
                                    .WithHttpServiceError(httpServiceError);

            return(responseNegotiator.NegotiateResponse(negotiator, context));
        }
예제 #2
0
        private static Response CreateNegociatedResponse(NancyContext context, Exception exception, IResponseNegotiator responseNegotiator)
        {
            var httpServiceError = HttpServiceErrorUtilities
                                   .ExtractFromException(exception, HttpServiceErrorDefinition.GeneralError);

            var negociator = new Negotiator(context)
                             .WithStatusCode(httpServiceError.HttpStatusCode)
                             .WithModel(httpServiceError.ServiceErrorModel);

            return(responseNegotiator.NegotiateResponse(negociator, context));
        }