Skip to content

Why no recoverable errors? #654

@TerranWorks

Description

@TerranWorks

Just a question, but I can't add the question tag. I'm just getting into petgraph because I know it to be the standard graph rust graph library, but I'm surprised that every operation panics instead of returning a result. I understand that panics aren't evil, but most other crates that I've worked with (Bevy for example) provide sister methods for those that panic which return results instead: e.g. graph.add_node(...) panics, so there would also be a graph.try_add_node(...) which returns a result that can be handled. Is there a reason why results don't seem to be used in petgraph? Like I said, I'm new to petgraph, so maybe I'm missing something obvious, but it just seems strange to me.

TL;DR Why do all methods panic instead of using recoverable errors by returning a Result<...>?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions