Improved error message when target is not found.

This commit is contained in:
Sleepy Monax 2023-02-06 15:04:15 +01:00
parent 7d4ba1e8d2
commit 5f313dc682
2 changed files with 7 additions and 4 deletions

View file

@ -90,7 +90,10 @@ def loadAllTargets() -> list[TargetManifest]:
def loadTarget(id: str) -> TargetManifest:
return next(filter(lambda t: t.id == id, loadAllTargets()))
try:
return next(filter(lambda t: t.id == id, loadAllTargets()))
except StopIteration:
raise Exception(f"Target '{id}' not found")
def loadAllComponents() -> list[ComponentManifest]:

View file

@ -3,10 +3,10 @@ from graphviz import Digraph
from osdk.context import Context
def view(context: Context, showExe: bool = False):
def view(context: Context, showExe: bool = True):
g = Digraph(context.target.id, filename='graph.gv')
g.attr('graph', splines='ortho', concentrate='true')
g.attr('graph', splines='ortho', rankdir='BT')
g.attr('node', shape='ellipse')
for instance in context.instances:
@ -20,6 +20,6 @@ def view(context: Context, showExe: bool = False):
g.edge(instance.manifest.id, req)
for req in instance.manifest.provides:
g.edge(req, instance.manifest.id)
g.edge(req, instance.manifest.id, arrowhead="none")
g.view(filename=f"{context.builddir()}/graph.gv")