Raise an error if Path._directions is not set ...

... instead of failing inside `json.loads()` on `None`
This commit is contained in:
Alexander Hess 2026-11-30 12:48:23 +01:00
commit 607055d55a
Signed by: alexander
GPG key ID: B46EDB4DFC26805D

View file

@ -270,6 +270,9 @@ class Path(meta.Base):
Implementation detail: This property is cached as none of the
underlying attributes (i.e., `._directions`) are to be changed.
"""
if not self._directions:
raise RuntimeError("_directions is not set")
points = [utils.Location(*point) for point in json.loads(self._directions)]
for point in points:
point.relate_to(self.first_address.city.southwest)