Skip to content

Commit b754b3c

Browse files
committed
[property] Add DType Failure Information
For append and extend methods, inferred and expected dtype are listed.
1 parent 09dc84e commit b754b3c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

odml/property.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -590,8 +590,8 @@ def extend(self, obj, strict=True):
590590
if len(new_value) > 0 and strict and dtypes.infer_dtype(new_value[0]) != self.dtype:
591591

592592
if not (dtypes.infer_dtype(new_value[0]) == "string" and self.dtype in dtypes.special_dtypes):
593-
raise ValueError("odml.Property.extend: "
594-
"passed value data type does not match dtype!")
593+
raise ValueError("odml.Property.extend: passed value data type found (\"%s\") "
594+
"does not match expected dtype \"%s\"!" % (dtypes.infer_dtype(new_value[0]), self._dtype))
595595

596596
if not self._validate_values(new_value):
597597
raise ValueError("odml.Property.extend: passed value(s) cannot be converted "
@@ -622,8 +622,8 @@ def append(self, obj, strict=True):
622622
if len(new_value) > 0 and strict and dtypes.infer_dtype(new_value[0]) != self.dtype:
623623

624624
if not (dtypes.infer_dtype(new_value[0]) == "string" and self.dtype in dtypes.special_dtypes):
625-
raise ValueError("odml.Property.append: "
626-
"passed value data type does not match dtype!")
625+
raise ValueError("odml.Property.append: passed value data type found (\"%s\") "
626+
"does not match expected dtype \"%s\"!" % (dtypes.infer_dtype(new_value[0]), self._dtype))
627627

628628
if not self._validate_values(new_value):
629629
raise ValueError("odml.Property.append: passed value(s) cannot be converted "

0 commit comments

Comments
 (0)