File tree Expand file tree Collapse file tree 1 file changed +15
-10
lines changed
Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -74,16 +74,21 @@ export class Renderer {
7474 }
7575
7676 private highlightNode ( svg : string , nodeId : string ) : string {
77- const dom = svgFromString ( svg ) ;
78- // We construct the SVG, so we know the node must exist.
79- const node : G = dom . findOne ( `g#${ nodeId } ` ) as G ;
80- // Same applies to the polygon.
81-
82- const poly : Polygon = node . findOne ( "polygon" ) as Polygon ;
83- // The highlight class is used when previewing colors in the demo.
84- node . addClass ( "highlight" ) ;
85- poly . fill ( listToScheme ( this . colorList ) [ "node.highlight" ] ) ;
86- return dom . svg ( ) ;
77+ try {
78+ const dom = svgFromString ( svg ) ;
79+ // We construct the SVG, so we know the node must exist.
80+ const node : G = dom . findOne ( `g#${ nodeId } ` ) as G ;
81+ // Same applies to the polygon.
82+
83+ const poly : Polygon = node . findOne ( "polygon" ) as Polygon ;
84+ // The highlight class is used when previewing colors in the demo.
85+ node . addClass ( "highlight" ) ;
86+ poly . fill ( listToScheme ( this . colorList ) [ "node.highlight" ] ) ;
87+ return dom . svg ( ) ;
88+ } catch ( e ) {
89+ console . error ( `Failed to highlight node ${ nodeId } :` , e ) ;
90+ return svg ;
91+ }
8792 }
8893
8994 private renderStatic ( functionSyntax : Parser . SyntaxNode , language : Language ) {
You can’t perform that action at this time.
0 commit comments