exceptions.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 #
3 # License: BSD
4 # https://raw.github.com/robotics-in-concert/rocon_multimaster/master/rocon_hub_client/LICENSE
5 #
6 
7 '''
8  Core exceptions raised when interacting with a rocon hub.
9 '''
10 ##############################################################################
11 # Imports
12 ##############################################################################
13 
14 from gateway_msgs.msg import ErrorCodes
15 
16 ##############################################################################
17 # Exceptions
18 ##############################################################################
19 
20 
21 class HubError(Exception):
22  def __init__(self, msg):
23  super(HubError, self).__init__(msg)
24  self.id = ''
25 
26 
27 # Raised when the gateway can't connect to the hub's redis server
29  def __init__(self, msg):
30  super(HubNotFoundError, self).__init__(msg)
31  self.id = ErrorCodes.HUB_CONNECTION_UNRESOLVABLE
32 
33 
34 # Raised when the hub's redis server has no key setting for the hub name.
36  def __init__(self, msg):
37  super(HubNameNotFoundError, self).__init__(msg)
38  self.id = ErrorCodes.HUB_NAME_NOT_FOUND
39 
40 
41 # When the hub name or uri is in the blacklist
43  def __init__(self, msg):
44  super(HubConnectionBlacklistedError, self).__init__(msg)
45  self.id = ErrorCodes.HUB_CONNECTION_BLACKLISTED
46 
47 
48 # When the hub name or uri is not in a non-empty whitelist
50  def __init__(self, msg):
51  super(HubConnectionNotWhitelistedError, self).__init__(msg)
52  self.id = ErrorCodes.HUB_CONNECTION_NOT_IN_NONEMPTY_WHITELIST
53 
54 
55 # When the hub name or uri is not in a non-empty whitelist
57  def __init__(self, msg):
58  super(HubConnectionAlreadyExistsError, self).__init__(msg)
59  self.id = ErrorCodes.HUB_CONNECTION_NOT_IN_NONEMPTY_WHITELIST
60 
61 
62 # Raised when a hub client tries an operation on a hub that has lost its
63 # connection
65  def __init__(self, msg):
66  super(HubConnectionLostError, self).__init__(msg)
67  self.id = ErrorCodes.HUB_CONNECTION_LOST
68 
69 
71  def __init__(self, msg):
72  super(HubConnectionFailedError, self).__init__(msg)
73  self.id = ErrorCodes.HUB_CONNECTION_FAILED


rocon_hub_client
Author(s): Daniel Stonier , Jihoon Lee
autogenerated on Mon Jun 10 2019 14:40:08