Skip to content

Add useful error messages/types to Result<T, ()> #3247

@evaporei

Description

@evaporei

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:

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions