Consider replacing unwrap with expect for error handling
Closed this issue · 2 comments
kenba commented
Volker made a good point about using expect() instead on unwrap() for handling errors.
Investigate whether all uses of unwrap() are correct and replace with expect() or some other mechanism if not.
kenba commented
The MIT effective rust examples (see: A brief interlude: unwrapping isn't evil) recommend only using unwrap():
- in examples and quick and dirty code;
- and when panicking indicates a bug in the program.
Clearly the library is currently using unwrap() in many more instances than those above.
Some common instances that require further consideration are drop() methods (i.e. destructors) and string conversion functions.
kenba commented
All unwrap() calls outside of examples and tests changed to either mapping CString errors or expect() calls.