Improved error message when target is not found.
This commit is contained in:
		
							parent
							
								
									7d4ba1e8d2
								
							
						
					
					
						commit
						5f313dc682
					
				
					 2 changed files with 7 additions and 4 deletions
				
			
		| 
						 | 
					@ -90,7 +90,10 @@ def loadAllTargets() -> list[TargetManifest]:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def loadTarget(id: str) -> 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]:
 | 
					def loadAllComponents() -> list[ComponentManifest]:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,10 +3,10 @@ from graphviz import Digraph
 | 
				
			||||||
from osdk.context import Context
 | 
					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 = 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')
 | 
					    g.attr('node', shape='ellipse')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for instance in context.instances:
 | 
					    for instance in context.instances:
 | 
				
			||||||
| 
						 | 
					@ -20,6 +20,6 @@ def view(context: Context, showExe: bool = False):
 | 
				
			||||||
            g.edge(instance.manifest.id, req)
 | 
					            g.edge(instance.manifest.id, req)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for req in instance.manifest.provides:
 | 
					        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")
 | 
					    g.view(filename=f"{context.builddir()}/graph.gv")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue