You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc.Filters;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
|
|
|
|
namespace DS.WMS.JobService
|
|
|
|
|
{
|
|
|
|
|
//public sealed class ArgumentExceptionHandler : IExceptionHandler
|
|
|
|
|
//{
|
|
|
|
|
// public async ValueTask<bool> TryHandleAsync(HttpContext httpContext, Exception exception, CancellationToken cancellationToken)
|
|
|
|
|
// {
|
|
|
|
|
// httpContext.RequestServices.GetRequiredService<ILogger<ArgumentExceptionHandler>>()
|
|
|
|
|
// .LogError(exception, "Exception handled");
|
|
|
|
|
// if (exception is not ArgumentException) return false;
|
|
|
|
|
|
|
|
|
|
// httpContext.Response.StatusCode = 400;
|
|
|
|
|
// await httpContext.Response.WriteAsJsonAsync(new
|
|
|
|
|
// {
|
|
|
|
|
// exception.Message
|
|
|
|
|
// }, cancellationToken);
|
|
|
|
|
// return true;
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
}
|