rospy: #2362 ROSInterruptException is now a subclass of KeyboardInterrupt
This commit is contained in:
parent
07a5e7b5fc
commit
961006e290
|
@ -52,10 +52,12 @@ class ROSInitException(ROSException):
|
|||
"""
|
||||
pass
|
||||
|
||||
class ROSInterruptException(ROSException):
|
||||
class ROSInterruptException(ROSException, KeyboardInterrupt):
|
||||
"""
|
||||
Exception for operations that interrupted, e.g. due to shutdown
|
||||
Exception for operations that interrupted, e.g. due to shutdown.
|
||||
|
||||
This is a subclass of both L{ROSException} and KeyboardInterrupt
|
||||
so that it can be used in logic tht expects either.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
|
|
@ -55,7 +55,17 @@ class TestRospyExceptions(unittest.TestCase):
|
|||
TransportException, TransportTerminated, TransportInitError]:
|
||||
exc = e('foo')
|
||||
self.assert_(isinstance(exc, ROSInternalException))
|
||||
|
||||
|
||||
def test_ROSInterruptException(self):
|
||||
from rospy.exceptions import ROSInterruptException, ROSException
|
||||
try:
|
||||
raise ROSInterruptException("test")
|
||||
except ROSException:
|
||||
pass
|
||||
try:
|
||||
raise ROSInterruptException("test")
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
|
||||
if __name__ == '__main__':
|
||||
import rostest
|
||||
|
|
Loading…
Reference in New Issue