2Copy of ROS2 `rclpy.exceptions` for ROS1.
4Supplemented copy from ROS2 `rclpy.exceptions`,
5at https://github.com/ros2/rclpy (`rclpy/rclpy/exceptions.py`),
6released under the Apache 2.0 License.
8------------------------------------------------------------------------------
9This file is part of rosros - simple unified interface to ROS1 / ROS2.
10Released under the BSD License.
15------------------------------------------------------------------------------
17## @namespace rosros.rclify.exceptions
19# Original file copyright notice:
21# Copyright 2016 Open Source Robotics Foundation, Inc.
23# Licensed under the Apache License, Version 2.0 (the "License");
24# you may not use this file except in compliance with the License.
25# You may obtain a copy of the License at
27# http://www.apache.org/licenses/LICENSE-2.0
37 """Raised when the rclpy implementation is accessed before rclpy.init()."""
40 Exception.__init__(self,
'rclpy.init() has not been called', *args)
44 """Raised when there is no type support imported."""
47 Exception.__init__(self,
'no type_support imported')
51 """Raised when a topic name, node name, or namespace are invalid."""
53 def __init__(self, name_type, name, error_msg, invalid_index, *args):
55Invalid {name_type}: {error_msg}:
58""".format(name_type=name_type, name=name, error_msg=error_msg, indent=' ' * invalid_index)
59 Exception.__init__(self, msg)
63 """Raised when a namespace is invalid."""
65 def __init__(self, name, error_msg, invalid_index, *args):
66 NameValidationException.__init__(self,
'namespace', name, error_msg, invalid_index)
70 """Raised when a node name is invalid."""
72 def __init__(self, name, error_msg, invalid_index, *args):
73 NameValidationException.__init__(self,
'node name', name, error_msg, invalid_index)
77 """Raised when a topic name is invalid."""
79 def __init__(self, name, error_msg, invalid_index, *args):
80 NameValidationException.__init__(self,
'topic name', name, error_msg, invalid_index)
84 """Raised when a service name is invalid."""
86 def __init__(self, name, error_msg, invalid_index, *args):
87 NameValidationException.__init__(self,
'service name', name, error_msg, invalid_index)
91 """Base exception for parameter-related errors."""
93 def __init__(self, error_msg, parameters, *args):
94 Exception.__init__(self, f
'{error_msg}: {parameters}')
98 """Raised when handling an undeclared parameter when it is not allowed."""
101 Exception.__init__(self,
'Invalid access to undeclared parameter(s)', parameters, *args)
105 """Raised when declaring a parameter that had been declared before."""
108 Exception.__init__(self,
'Parameter(s) already declared', parameters, *args)
112 """Raised when a parameter to be declared has an invalid name."""
115 Exception.__init__(self,
'Invalid parameter name', parameter, *args)
119 """Raised when a parameter is rejected by a user callback or when applying a descriptor."""
121 def __init__(self, parameter, value, reason, *args):
124 'Invalid parameter value ({value}) for parameter. Reason: {reason}'.format(
125 value=value, reason=reason), parameter, *args)
129 """Raised when a read-only parameter is modified."""
132 Exception.__init__(self,
'Attempted to modify read-only parameter', parameter, *args)
136 """Raised when an operation is canceled by rclpy shutting down."""
139 Exception.__init__(self,
'rclpy.shutdown() has been called', *args)
Raised when a namespace is invalid.
__init__(self, name, error_msg, invalid_index, *args)
Raised when a node name is invalid.
__init__(self, name, error_msg, invalid_index, *args)
Raised when a parameter to be declared has an invalid name.
__init__(self, parameter, *args)
Raised when a parameter is rejected by a user callback or when applying a descriptor.
__init__(self, parameter, value, reason, *args)
Raised when a service name is invalid.
__init__(self, name, error_msg, invalid_index, *args)
Raised when a topic name is invalid.
__init__(self, name, error_msg, invalid_index, *args)
Raised when a topic name, node name, or namespace are invalid.
__init__(self, name_type, name, error_msg, invalid_index, *args)
Raised when there is no type support imported.
Raised when the rclpy implementation is accessed before rclpy.init().
Raised when declaring a parameter that had been declared before.
__init__(self, parameters, *args)
Base exception for parameter-related errors.
__init__(self, error_msg, parameters, *args)
Raised when a read-only parameter is modified.
__init__(self, parameter, *args)
Raised when handling an undeclared parameter when it is not allowed.
__init__(self, parameters, *args)
Raised when an operation is canceled by rclpy shutting down.