rosros 0.2.5
Simple unified interface to ROS1 / ROS2 Python API
Loading...
Searching...
No Matches
exceptions.py
Go to the documentation of this file.
1"""
2Copy of ROS1 `rospy.exceptions` for ROS2, plus a few other rospy exceptions.
3
4Supplemented copy from ROS1 `rospy.exceptions`,
5at https://github.com/ros/ros_comm (`clients/rospy/src/rospy/exceptions.py`),
6released under the BSD License.
7
8------------------------------------------------------------------------------
9This file is part of rosros - simple unified interface to ROS1 / ROS2.
10Released under the BSD License.
11
12@author Erki Suurjaak
13@created 01.03.2022
14@modified 07.03.2022
15------------------------------------------------------------------------------
16"""
17## @namespace rosros.rospify.exceptions
18
19# Original file copyright notice:
20
21# Software License Agreement (BSD License)
22#
23# Copyright (c) 2008, Willow Garage, Inc.
24# All rights reserved.
25#
26# Redistribution and use in source and binary forms, with or without
27# modification, are permitted provided that the following conditions
28# are met:
29#
30# * Redistributions of source code must retain the above copyright
31# notice, this list of conditions and the following disclaimer.
32# * Redistributions in binary form must reproduce the above
33# copyright notice, this list of conditions and the following
34# disclaimer in the documentation and/or other materials provided
35# with the distribution.
36# * Neither the name of Willow Garage, Inc. nor the names of its
37# contributors may be used to endorse or promote products derived
38# from this software without specific prior written permission.
39#
40# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
41# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
42# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
43# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
44# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
45# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
46# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
47# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
48# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
50# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
51# POSSIBILITY OF SUCH DAMAGE.
52
53
55 """Base exception class for ROS clients"""
56
58 """Exception for message serialization errors"""
59
61 """Exception for errors initializing ROS state"""
62
64 """
65 Exception for operations that interrupted, e.g. due to shutdown.
66
67 This is a subclass of both ROSException and KeyboardInterrupt
68 so that it can be used in logic that expects either.
69 """
70
71class ROSTimeMovedBackwardsException(ROSInterruptException):
72 """Exception if time moved backwards"""
73
74 def __init__(self, time):
75 self.time = time
76 """The amount of time in seconds."""
77 super().__init__("ROS time moved backwards")
78
80 """Base class for exceptions that are internal to the ROS system"""
81
82class TransportException(ROSInternalException):
83 """Base class for transport-related exceptions"""
84
86 """Internal class for representing broken connections"""
87
89 """Internal exception for representing exceptions that occur establishing transports"""
90
92 """Exception that is raised when a parameter fails validation checks"""
93 def __init__(self, message):
94 self._message = message
95
96 def __str__(self):
97 return str(self._message)
Base exception class for ROS clients.
Definition exceptions.py:54
Exception for operations that interrupted, e.g.
Definition exceptions.py:60
Base class for exceptions that are internal to the ROS system.
Definition exceptions.py:79
Exception if time moved backwards.
Definition exceptions.py:69
Exception for errors initializing ROS state.
Definition exceptions.py:58
Internal class for representing broken connections.
Definition exceptions.py:83
Exception that is raised when a parameter fails validation checks.
Definition exceptions.py:89
Internal exception for representing exceptions that occur establishing transports.
Definition exceptions.py:85