Display graph errors in the viewport (#1577)
* Display graph errors in the viewport * Polish up the styling * Clear click targets while graph can't be rendered --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
parent
484acbcde3
commit
8df59be1d5
|
|
@ -634,6 +634,17 @@ impl PortfolioMessageHandler {
|
|||
|
||||
self.executor.poll_node_graph_evaluation(active_document, responses).unwrap_or_else(|e| {
|
||||
log::error!("Error while evaluating node graph: {e}");
|
||||
|
||||
let error = r#"
|
||||
<rect x="50%" y="50%" width="480" height="100" transform="translate(-240 -50)" rx="4" fill="var(--color-error-red)" />
|
||||
<text x="50%" y="50%" dominant-baseline="middle" text-anchor="middle" font-size="18" fill="var(--color-2-mildblack)">
|
||||
<tspan x="50%" dy="-24" font-weight="bold">The document cannot be rendered in its current state.</tspan>
|
||||
<tspan x="50%" dy="24">Check for error details in the node graph, which can be</tspan>
|
||||
<tspan x="50%" dy="24">opened with the viewport's top right <tspan font-style="italic">Node Graph</tspan> button.</tspan>
|
||||
/text>"#
|
||||
// It's a mystery why the `/text>` tag above needs to be missing its `<`, but when it exists it prints the `<` character in the text. However this works with it removed.
|
||||
.to_string();
|
||||
responses.add(FrontendMessage::UpdateDocumentArtwork { svg: error });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -558,7 +558,12 @@ impl NodeGraphExecutor {
|
|||
responses.add(BroadcastEvent::DocumentIsDirty);
|
||||
responses.add(OverlaysMessage::Draw);
|
||||
|
||||
let node_graph_output = result.map_err(|e| format!("Node graph evaluation failed: {e:?}"))?;
|
||||
let Ok(node_graph_output) = result else {
|
||||
// Clear the click targets while the graph is in an un-renderable state
|
||||
document.metadata.update_click_targets(HashMap::new());
|
||||
|
||||
return Err("Node graph evaluation failed".to_string());
|
||||
};
|
||||
|
||||
document.metadata.update_transforms(new_upstream_transforms);
|
||||
document.metadata.update_click_targets(new_click_targets);
|
||||
|
|
|
|||
Loading…
Reference in New Issue