NixOS / NixOS/ofborg

[tracking] Better error handling

Open
#443 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
323
Forks
171
PR merge metrics
No merged PRs in 30d

Description

This is a general tracking issue for the removal of (or to at least greatly
diminish the presence of) unwraps and expects, to guard against runtime
panics.

Some tasks that come to mind:

  • Convert all Result<..., String> types to be Result<..., Error> and roll an
    Error enum for each place with a non-trivial amount of errors to handle
    • As a result (no pun intended), convert instances of unwrap/expect,
      wherever possible, to use the ? operator to propagate errors up
    • Maybe use anyhow to reduce boilerplate?
  • Remove as many instances of unwrap and expect as possible in order to
    decrease the occurrence of panics
    • At the very least, convert unwraps to expects, to indicate what the problem was and where it occurred

cc @grahamc

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inventorying the project's unwrap, expect, and Result<..., String> uses to identify a focused area with non-trivial error handling. Check whether existing error enums or propagation patterns provide a suitable scope. Done means reducing panics in the selected area and using informative, typed error handling where appropriate.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.