public override async Task UnaryServerHandler()

in src/Middleware/Grpc/Server/ProtoValidate.cs [23:50]


    public override async Task<TResponse> UnaryServerHandler<TRequest, TResponse>(
        TRequest request, ServerCallContext context, UnaryServerMethod<TRequest, TResponse> continuation)
    {
        try
        {
            // _logger.Information("Starting validation for request of type {RequestType}", typeof(TRequest).Name);

            if (!ValidateMsg(request, out var error))
            {
                var status = new Status(StatusCode.InvalidArgument, error);
                _logger.Warning("Validation failed for request of type {RequestType}: {Error}", typeof(TRequest).Name, error);
                throw new RpcException(status);
            }

            // _logger.Information("Validation successful for request of type {RequestType}", typeof(TRequest).Name);
            return await continuation(request, context);
        }
        catch (RpcException ex)
        {
            _logger.Error(ex, "Validation error for request of type {RequestType}: {ErrorDetail}", typeof(TRequest).Name, ex.Status.Detail);
            throw;
        }
        catch (Exception ex)
        {
            _logger.Error(ex, "Unexpected error during validation for request of type {RequestType}", typeof(TRequest).Name);
            throw new RpcException(new Status(StatusCode.Internal, "Internal server error"));
        }
    }