[PcbDraw] Better error when a style is missing

- Now we don't lie about using a path if the name is absolute
This commit is contained in:
Salvador E. Tropea 2023-04-16 09:00:02 -03:00
parent 1b66992088
commit 97ff9a0d09
1 changed files with 4 additions and 2 deletions

View File

@ -1174,8 +1174,10 @@ class PcbPlotter():
"""
path = self._find_data_file(name, ".json", "styles")
if path is None:
raise RuntimeError(f"Cannot locate resource {name}; explored paths:\n"
+ "\n".join([f"- {x}" for x in self.data_path]))
err_msg = "Cannot locate resource "+name
if not os.path.isabs(name):
err_msg += "; explored paths:\n"+"\n".join([f"- {x}" for x in self.data_path])
raise RuntimeError(err_msg)
self.style = load_style(path)
def unique_prefix(self) -> str: