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;
 }