@@ -365,7 +365,7 @@ def validate_with_custom(self, service_type: str, args: Dict[str, Any]):
365
365
try :
366
366
model .model_validate (args )
367
367
except ValidationError as e :
368
- raise ValueError (f"Pydantic validation failed: { e } " )
368
+ raise ValueError (f"Pydantic validation failed: { e } " ) from e
369
369
370
370
def validate (self , service_type : str , args : Dict [str , Any ]):
371
371
"""
@@ -380,7 +380,7 @@ def validate(self, service_type: str, args: Dict[str, Any]):
380
380
if service_type in self .custom_models :
381
381
self .validate_with_custom (service_type , args )
382
382
else :
383
- return self .validate_with_ros2 (service_type , args )
383
+ self .validate_with_ros2 (service_type , args )
384
384
385
385
386
386
class MockCallROS2ServiceTool (CallROS2ServiceTool ):
@@ -402,6 +402,18 @@ def _run(
402
402
service_args : Optional [Dict [str , Any ]] = None ,
403
403
timeout_sec : float = 1.0 ,
404
404
) -> str :
405
+ """
406
+ Execute the mocked ROS2 service call with validation of service type and its args.
407
+
408
+ Parameters
409
+ ----------
410
+ service_name : str
411
+ Name of the service to call
412
+ service_type : str
413
+ Type of the service
414
+ service_args : Optional[Dict[str, Any]], optional
415
+ Arguments for the service call, by default None
416
+ """
405
417
if service_name not in self .available_services :
406
418
raise ValueError (
407
419
f"Service { service_name } is not available within { timeout_sec } seconds. Check if the service exists."
0 commit comments