Skip to content

Simplify error handling in node code - #4760

Merged
TrueDoctor merged 2 commits into
masterfrom
node-error-improvements
Oct 22, 2026
Merged

TrueDoctor merged 2 commits into
masterfrom
node-error-improvements

Conversation

@timon-schelling

@timon-schelling timon-schelling commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Allow nodes to return any impl Into<NodeError> and allow async nodes to return error and fallback.

#[node_macro::node(...)]
fn parse(_: impl Ctx, text: Item<String>) -> Result<Item<f64>, ParseFloatError> {
	Ok(Item::new_from_element(text.element().parse()?))
}

#[node_macro::node(...)]
async fn load(_: impl Ctx, hash: Item<ResourceHash>) -> Result<Item<Resource>, std::io::Error> {
	let resource = storage.load(*hash.element()).await.ok_or_else(|| std::io::Error::other("Not in storage"))?;
	Ok(Item::new_from_element(resource))
}

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 4 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread node-graph/libraries/core-types/src/poll.rs
@TrueDoctor
TrueDoctor added this pull request to the merge queue Oct 22, 2026
Merged via the queue into master with commit 90df050 Oct 22, 2026
11 checks passed
@TrueDoctor
TrueDoctor deleted the node-error-improvements branch October 22, 2026 08:29
VimYoung pushed a commit to VimYoung/Graphite that referenced this pull request Oct 26, 2026
* Let nodes return errors that convert into NodeError

* Let async nodes return errors and fallbacks

This branch was successfully deployed

1 active deployment
graphite-dev (Preview) — 2f9f683e Deployed Oct 20, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants