#14188 GrpcInterface: Handle copyPdmObjectFromRipsToCaf result in CallPdmObjectMethod

The return value of copyPdmObjectFromRipsToCaf was discarded when copying method parameters in CallPdmObjectMethod. Check the std::expected result and return a gRPC INVALID_ARGUMENT status (with telemetry and logging) when parameter validation fails, instead of silently proceeding to execute the method.
This commit is contained in:
Magne Sjaastad
2026-06-10 12:34:59 +02:00
parent 76d0ff3d3c
commit 714dda1aff
+10 -1
View File
@@ -568,7 +568,16 @@ grpc::Status RiaGrpcPdmObjectService::CallPdmObjectMethod( grpc::ServerContext*
caf::PdmObjectMethodFactory::instance()->createMethod( matchingObject, methodKeyword );
if ( method )
{
copyPdmObjectFromRipsToCaf( &( request->params() ), method.get() );
if ( auto result = copyPdmObjectFromRipsToCaf( &( request->params() ), method.get() ); !result )
{
telemetryAttributes["pdm.status"] = "failed";
telemetryAttributes["pdm.error"] = result.error().toStdString();
RiaOpenTelemetryManager::instance().reportEventAsync( "grpc.pdm_method_call", telemetryAttributes );
RiaLogging::error(
QString( "Method '%1' failed. Error: %2" ).arg( methodKeyword ).arg( result.error() ).toStdString() );
return grpc::Status( grpc::INVALID_ARGUMENT, result.error().toStdString() );
}
// clang-tidy-19 has a bug that did the following:
// std::expected<caf::PdmObjectHandle, QString> result = method->execute();