graphprotocol / graphprotocol/graph-node
Add useful error messages/types to Result<T, ()>
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 3.2k
- Forks
- 1.1k
- Avg merge
- 4d 1h
- Merged PRs (30d)
- 1
Description
There are multiple functions that return Result<T, ()> in the code, this is equivalent to Option<T>, however instead of changing those to optional types, these should return useful error messages/types so it's easier to debug.
Some of them could just return &str/String but preferably they should return a proper error type or just an instance of anyhow. If for any of them you decide to create new error types, consider using the crate thiserror 🙂
If you never used any of these crates mentioned above, take a look at our codebase, you'll find usages of both. And if you're doing something outside of the graph crate/folder, you might want to import those from it's prelude module.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with graph/src/data/subgraph/mod.rs at the linked example, then search the codebase for functions returning Result<T, ()>. Review existing usages of anyhow and thiserror, and map each candidate's failure cases before deciding on useful error messages or types. Done means the relevant unit-like results no longer discard error information across the identified code paths.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100