Skip to content

Commit f494af9

Browse files
committed
Improved TypeError message.
1 parent cd053fc commit f494af9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

bson/binary.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,9 @@ def from_vector(
511511
"Failed to create binary from vector. Check type. If numpy array, numpy must be installed."
512512
) from exc
513513
if not isinstance(vector, np.ndarray):
514-
raise TypeError("Vector must be a numpy array.")
514+
raise TypeError(
515+
"Could not create Binary. Vector must be a BinaryVector, list[int], list[float] or numpy ndarray."
516+
)
515517
if vector.ndim != 1:
516518
raise ValueError(
517519
"from_numpy_vector only supports 1D arrays as it creates a single vector."

0 commit comments

Comments
 (0)