-
Notifications
You must be signed in to change notification settings - Fork 1k
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.
Example:
graph-node/graph/src/data/subgraph/mod.rs
Line 169 in 79390c3
pub fn new(s: impl Into<String>) -> Result<Self, ()> { |
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.