22 lines
706 B
C#
22 lines
706 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
|
|
} |