Skip to content

Consider changing check() to return Result<bool, E> #22

@moodmosaic

Description

@moodmosaic

Right now Command::check() returns a bool. This is simple, but makes it hard to debug when something fallible happens inside a check (e.g. lock acquisition, DB access).

Normally check() should avoid side effects — but we can't enforce that at the type level in Rust. We're not in Haskell. Implementers may do I/O or locking, and panics or silent failures can short-circuit the test run with no explanation.

We're considering switching to:

fn check(&self, state: &S) -> Result<bool, E>;

This would let the runner surface useful diagnostics without panicking or swallowing errors. We could start with E = &'static str or Box<dyn std::error::Error>.

Not settled yet — opening this for discussion. Credit to @cylewitruk for raising the point.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions