logger handles exception

This commit is contained in:
2025-10-23 11:37:12 -05:00
parent bac8d74803
commit 4198198e02
2 changed files with 6 additions and 3 deletions

View File

@@ -16,8 +16,8 @@ class Vector(object):
def dot(self, v):
"""Returns the dot product with Vector *v*."""
if not isinstance(v, self.__class__):
logger.error(f"Expected an instance of {self.__class__}, but got {type(v)} instead.")
return None
msg = f"Expected an instance of {self.__class__}, but got {type(v)} instead."
raise ValueError(msg)
d = self.x * v.x + self.y * v.y + self.z * v.z
return d