exceptions.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 #
00003 # License: BSD
00004 #   https://raw.github.com/robotics-in-concert/rocon_multimaster/master/rocon_hub_client/LICENSE
00005 #
00006 
00007 '''
00008   Core exceptions raised when interacting with a rocon hub.
00009 '''
00010 ##############################################################################
00011 # Imports
00012 ##############################################################################
00013 
00014 from gateway_msgs.msg import ErrorCodes
00015 
00016 ##############################################################################
00017 # Exceptions
00018 ##############################################################################
00019 
00020 
00021 class HubError(Exception):
00022     def __init__(self, msg):
00023         super(HubError, self).__init__(msg)
00024         self.id = ''
00025 
00026 
00027 # Raised when the gateway can't connect to the hub's redis server
00028 class HubNotFoundError(HubError):
00029     def __init__(self, msg):
00030         super(HubNotFoundError, self).__init__(msg)
00031         self.id = ErrorCodes.HUB_CONNECTION_UNRESOLVABLE
00032 
00033 
00034 # Raised when the hub's redis server has no key setting for the hub name.
00035 class HubNameNotFoundError(HubError):
00036     def __init__(self, msg):
00037         super(HubNameNotFoundError, self).__init__(msg)
00038         self.id = ErrorCodes.HUB_NAME_NOT_FOUND
00039 
00040 
00041 # When the hub name or uri is in the blacklist
00042 class HubConnectionBlacklistedError(HubError):
00043     def __init__(self, msg):
00044         super(HubConnectionBlacklistedError, self).__init__(msg)
00045         self.id = ErrorCodes.HUB_CONNECTION_BLACKLISTED
00046 
00047 
00048 # When the hub name or uri is not in a non-empty whitelist
00049 class HubConnectionNotWhitelistedError(HubError):
00050     def __init__(self, msg):
00051         super(HubConnectionNotWhitelistedError, self).__init__(msg)
00052         self.id = ErrorCodes.HUB_CONNECTION_NOT_IN_NONEMPTY_WHITELIST
00053 
00054 
00055 # When the hub name or uri is not in a non-empty whitelist
00056 class HubConnectionAlreadyExistsError(HubError):
00057     def __init__(self, msg):
00058         super(HubConnectionAlreadyExistsError, self).__init__(msg)
00059         self.id = ErrorCodes.HUB_CONNECTION_NOT_IN_NONEMPTY_WHITELIST
00060 
00061 
00062 # Raised when a hub client tries an operation on a hub that has lost its
00063 # connection
00064 class HubConnectionLostError(HubError):
00065     def __init__(self, msg):
00066         super(HubConnectionLostError, self).__init__(msg)
00067         self.id = ErrorCodes.HUB_CONNECTION_NOT_IN_NONEMPTY_WHITELIST


rocon_hub_client
Author(s): Daniel Stonier , Jihoon Lee
autogenerated on Sat Jun 8 2019 18:48:43