#9336 Python: Improve error reporting from gRPC to client

Surface gRPC failure context to Python script authors instead of
silently returning sentinel values or raising bare gRPC errors.

- RipsError now carries code/details/location and a from_rpc_error()
  helper. Existing single-arg construction stays valid.
- Stop swallowing grpc.RpcError in case.__grid_count for non-NOT_FOUND
  failures and in instance._check_connection_and_version, so the
  underlying status is propagated.
- pdmobject add_method decorator and _call_pdm_method_* attach
  code/details to the raised RipsError; existing message text is
  preserved so pytest match=... assertions keep working.
- Instance.start_heartbeat / stop_heartbeat / check_alive provide an
  opt-in background ping that flips a sticky lost-connection flag and
  raises a readable RipsError from check_alive() if the server dies.
- Server side: GetPdmObject in RiaGrpcAppService, RiaGrpcCaseService
  and RiaGrpcProjectService no longer return Status::OK with an empty
  reply when the underlying object is missing; they return NOT_FOUND
  / INTERNAL with a descriptive message. Other RiaGrpc*Service files
  audited and already return non-OK with text on error paths.
This commit is contained in:
Kristian Bendiksen committed 2026-05-04 20:03:39 +02:00
1 parent 1564df8115
commit f8d180f48d
9 files changed
+308 -28

No files matched your search

+2 -1
View File
@@ -176,8 +176,9 @@ grpc::Status RiaGrpcCaseService::GetPdmObject( grpc::ServerContext* context,
if ( rimCase )
{
copyPdmObjectFromCafToRips( rimCase, reply );
return grpc::Status::OK;
}
return grpc::Status::OK;
return grpc::Status( grpc::NOT_FOUND, "Case not found" );
}
//--------------------------------------------------------------------------------------------------