Ejemplo n.º 1
0
    def __init__(self, errmsg, code, type):

        self.__type = type
        self.__errmsg = errmsg
        self.__code = code
        self.__details = None

        if code is not None and isinstance(code, int):
            try:
                self.__details = common.get_info(code)
            except KeyError:
                self.__details = None

        Exception.__init__(self, errmsg)
Ejemplo n.º 2
0
   def __init__(self, errmsg, code, type):

      self.__type    = type
      self.__errmsg  = errmsg
      self.__code    = code
      self.__details = None

      if code is not None and isinstance(code, int):
         try:
            self.__details = common.get_info(code)
         except KeyError:
            self.__details = None

      Exception.__init__(self, errmsg)
Ejemplo n.º 3
0
def _raise_if_error(msg, rc):
    """Check return value, raise a SDBBaseError if error occurred.
   """
    if const.SDB_OK != rc:
        try:
            _ = get_info(rc)
        except KeyError:
            raise SDBUnknownError(msg)

        if rc in io_error:
            raise SDBIOError(msg, rc)
        elif rc in net_error:
            raise SDBNetworkError(msg, rc)
        elif rc in invalid_error:
            raise InvalidParameter(msg, rc)
        elif rc in system_error:
            raise SDBSystemError(msg, rc)
        else:
            raise SDBError(msg, rc)
Ejemplo n.º 4
0
def _raise_if_error(msg, rc):
   """Check return value, raise a SDBBaseError if error occurred.
   """
   if const.SDB_OK != rc:
      try:
         _ = get_info(rc)
      except KeyError:
         raise SDBUnknownError(msg)

      if rc in io_error:
         raise SDBIOError(msg, rc)
      elif rc in net_error:
         raise SDBNetworkError(msg, rc)
      elif rc in invalid_error:
         raise InvalidParameter(msg, rc)
      elif rc in system_error:
         raise SDBSystemError(msg, rc)
      else:
         raise SDBError(msg, rc)