Raise an error if Path._directions is not set ...
... instead of failing inside `json.loads()` on `None`
This commit is contained in:
parent
744d9a6353
commit
607055d55a
1 changed files with 10 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue