From cd0f80691f8024cb22a6352cceb656ce693fcde5 Mon Sep 17 00:00:00 2001 From: Andre Vallestero <39736205+AndreVallestero@users.noreply.github.com> Date: Thu, 23 Nov 2023 22:53:30 -0500 Subject: [PATCH] Add error message for invalid Path point range As described on the README, "these parameterizations are defined over the domain 0 <= t <= 1". Otherwise, the user gets "Something went wrong" which is not very helpful. --- svgpathtools/path.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/svgpathtools/path.py b/svgpathtools/path.py index 8ccab5c..89f505c 100644 --- a/svgpathtools/path.py +++ b/svgpathtools/path.py @@ -2573,6 +2573,8 @@ class Path(MutableSequence): # Shortcuts if len(self._segments) == 0: raise ValueError("This path contains no segments!") + if pos < 0.0 or pos > 1.0: + raise ValueError("Pos for Path.point must be between 0 and 1, but was {}".format(pos)) if pos == 0.0: return self._segments[0].point(pos) if pos == 1.0: