Skip to content

Reduce uses of unwrap/expect #30

@josephlr

Description

@josephlr

The current code uses unwrap() and expect() more than it strictly needs to. A better approach would be to have the function return an error in these cases.

Specifically, the error type could be changed to be an enum with variants for:

  • IO error, when the syscall fails
  • Invalid UTF8
  • Invalid Null Byte
  • other error conditions we’re currently just panicking on

As this would change the error type, it would be a breaking change. However, if this was done correctly, a lot of the code where we currently use unwrap could just use “?”

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions