def error(self, obj, name, value):
        """Returns a descriptive error string."""

        # pylint: disable=E1101
        if self.low is None and self.high is None:
            if self.units:
                info = "a float having units compatible with '%s'" % self.units
            else:
                info = "a float"
        elif self.low is not None and self.high is not None:
            right = ']'
            left = '['
            if self.exclude_high is True:
                right = ')'
            if self.exclude_low is True:
                left = '('
            info = "a float in the range %s%s, %s%s" % \
                   (left, self.low, self.high, right)
        elif self.low is not None:
            info = "a float with a value > %s" % self.low
        else:  # self.high is not None
            info = "a float with a value < %s" % self.high

        vtype = type(value)
        msg = "Variable '%s' must be %s, but a value of %s %s was specified." \
              % (name, info, value, vtype)
        try:
            obj.raise_exception(msg, ValueError)
        except __HOLE__:
            raise ValueError(msg)
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/datatypes/float.py/Float.error