public async Task InvokeAsync(HttpContext httpContext) { try { await _next(httpContext); } catch (CustomException ex) { await ExceptionService.HandleCustomException(httpContext, ex); } catch (Exception ex) { await ExceptionService.HandleException(httpContext, ex); } }