Merge branch 'dev' of https://github.com/dotnet/eShopOnContainers into dev
This commit is contained in:
commit
5efd0f690b
@ -1,5 +1,6 @@
|
|||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
using MediatR;
|
using MediatR;
|
||||||
|
using Ordering.Domain.Exceptions;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -33,8 +34,8 @@ namespace Ordering.API.Application.Decorators
|
|||||||
|
|
||||||
if (failures.Any())
|
if (failures.Any())
|
||||||
{
|
{
|
||||||
throw new ValidationException(
|
throw new OrderingDomainException(
|
||||||
$"Command Validation Errors for type {typeof(TRequest).Name}", failures);
|
$"Command Validation Errors for type {typeof(TRequest).Name}", new ValidationException("Validation exception", failures));
|
||||||
}
|
}
|
||||||
|
|
||||||
var response = await _inner.Handle(message);
|
var response = await _inner.Handle(message);
|
||||||
|
@ -32,6 +32,8 @@
|
|||||||
Messages = new[] { context.Exception.Message }
|
Messages = new[] { context.Exception.Message }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Result asigned to a result object but in destiny the response is empty. This is a known bug of .net core 1.1
|
||||||
|
//It will be fixed in .net core 1.1.2. See https://github.com/aspnet/Mvc/issues/5594 for more information
|
||||||
context.Result = new BadRequestObjectResult(json);
|
context.Result = new BadRequestObjectResult(json);
|
||||||
context.HttpContext.Response.StatusCode = (int)HttpStatusCode.BadRequest;
|
context.HttpContext.Response.StatusCode = (int)HttpStatusCode.BadRequest;
|
||||||
}
|
}
|
||||||
@ -47,6 +49,8 @@
|
|||||||
json.DeveloperMeesage = context.Exception;
|
json.DeveloperMeesage = context.Exception;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Result asigned to a result object but in destiny the response is empty. This is a known bug of .net core 1.1
|
||||||
|
// It will be fixed in .net core 1.1.2. See https://github.com/aspnet/Mvc/issues/5594 for more information
|
||||||
context.Result = new InternalServerErrorObjectResult(json);
|
context.Result = new InternalServerErrorObjectResult(json);
|
||||||
context.HttpContext.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
|
context.HttpContext.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user