Files
Examples/GerstITS.Examples.Api/Common/ExceptionHandling/Transformations/ValidationExceptionTransformation.cs
2021-06-15 10:59:47 +02:00

24 lines
730 B
C#

using System.ComponentModel.DataAnnotations;
using System.Net;
using GerstITS.Web.Api.ExceptionHandling;
namespace GerstITS.Examples.Api.ExceptionHandling
{
internal sealed class ValidationExceptionTransformation : ExceptionTransformationBase<ValidationException>
{
#region Methods
protected override ExceptionTransformationInfo CreateExceptionTransformationInfo(ValidationException exception, string ticketId)
{
return new ExceptionTransformationInfo
{
StatusCode = HttpStatusCode.BadRequest,
ReasonPhrase = "Validierungsfehler",
Details = exception.Message
};
}
#endregion
}
}