Skip to content

Commit 714dda1

Browse files
committed
#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.
1 parent 76d0ff3 commit 714dda1

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

GrpcInterface/RiaGrpcPdmObjectService.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,16 @@ grpc::Status RiaGrpcPdmObjectService::CallPdmObjectMethod( grpc::ServerContext*
568568
caf::PdmObjectMethodFactory::instance()->createMethod( matchingObject, methodKeyword );
569569
if ( method )
570570
{
571-
copyPdmObjectFromRipsToCaf( &( request->params() ), method.get() );
571+
if ( auto result = copyPdmObjectFromRipsToCaf( &( request->params() ), method.get() ); !result )
572+
{
573+
telemetryAttributes["pdm.status"] = "failed";
574+
telemetryAttributes["pdm.error"] = result.error().toStdString();
575+
RiaOpenTelemetryManager::instance().reportEventAsync( "grpc.pdm_method_call", telemetryAttributes );
576+
577+
RiaLogging::error(
578+
QString( "Method '%1' failed. Error: %2" ).arg( methodKeyword ).arg( result.error() ).toStdString() );
579+
return grpc::Status( grpc::INVALID_ARGUMENT, result.error().toStdString() );
580+
}
572581

573582
// clang-tidy-19 has a bug that did the following:
574583
// std::expected<caf::PdmObjectHandle, QString> result = method->execute();

0 commit comments

Comments
 (0)