コード例 #1
0
        private Response DefaultError(NancyContext ctx)
        {
            var defaultErrorRepresentation = new ErrorRepresentation(HttpStatusCode.InternalServerError, DefaultErrorCode);

            defaultErrorRepresentation.Message = DefaultErrorMessage;

            var negotiator = new Negotiator(ctx).WithStatusCode(HttpStatusCode.InternalServerError).WithModel(defaultErrorRepresentation);

            return responseNegotiator.NegotiateResponse(negotiator, ctx);
        }
コード例 #2
0
 public ErrorMapping(Type exceptionType, HttpStatusCode httpStatusCode, ErrorRepresentation errorRepresentation)
 {
     ExceptionType = exceptionType;
     HttpStatusCode = httpStatusCode;
     Representation = errorRepresentation;
 }