mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-31 05:19:53 +00:00
fix: add debugging context to NullGraphError throws
- Add node ID to NullGraphError messages for easier debugging - Add test verifying rootGraph throws after node removal Amp-Thread-ID: https://ampcode.com/threads/T-019c0dad-0101-74ca-92fd-0fd1a992d889 Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -194,7 +194,10 @@ export class ExecutableNodeDTO implements ExecutableLGraphNode {
|
||||
}
|
||||
}
|
||||
|
||||
if (!subgraphNode.graph) throw new NullGraphError()
|
||||
if (!subgraphNode.graph)
|
||||
throw new NullGraphError(
|
||||
`SubgraphNode ${subgraphNode.id} has no graph during input resolution`
|
||||
)
|
||||
const outerLink = subgraphNode.graph.getLink(linkId)
|
||||
if (!outerLink)
|
||||
throw new InvalidLinkError(
|
||||
|
||||
@@ -59,6 +59,18 @@ describe.skip('SubgraphNode Construction', () => {
|
||||
expect(subgraphNode.rootGraph).toBe(parentGraph.rootGraph)
|
||||
})
|
||||
|
||||
it('should throw NullGraphError when accessing rootGraph after removal', () => {
|
||||
const subgraph = createTestSubgraph()
|
||||
const subgraphNode = createTestSubgraphNode(subgraph)
|
||||
const parentGraph = subgraphNode.graph!
|
||||
parentGraph.add(subgraphNode)
|
||||
|
||||
parentGraph.remove(subgraphNode)
|
||||
|
||||
expect(() => subgraphNode.rootGraph).toThrow()
|
||||
expect(subgraphNode.graph).toBeNull()
|
||||
})
|
||||
|
||||
subgraphTest(
|
||||
'should synchronize slots with subgraph definition',
|
||||
({ subgraphWithNode }) => {
|
||||
|
||||
@@ -51,7 +51,8 @@ export class SubgraphNode extends LGraphNode implements BaseLGraph {
|
||||
override graph: GraphOrSubgraph | null
|
||||
|
||||
get rootGraph(): LGraph {
|
||||
if (!this.graph) throw new NullGraphError()
|
||||
if (!this.graph)
|
||||
throw new NullGraphError(`SubgraphNode ${this.id} has no graph`)
|
||||
return this.graph.rootGraph
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user