RustDDS icon indicating copy to clipboard operation
RustDDS copied to clipboard

Find `unwrap()` and `expect()`calls and eliminate them

Open jhelovuo opened this issue 5 years ago • 4 comments

Either replace with more graceful error-handling or write comments to justify why panic cannot occur.

jhelovuo avatar Feb 14 '21 10:02 jhelovuo

I highly recommend the eyre error library for applications that want rich error support. But the eyre says that thiserror is a good choice for errors you want to match against (common for libraries).

https://github.com/yaahc/eyre#comparison-to-thiserror https://docs.rs/thiserror/latest/thiserror/

This will give you a useful path forward when you are chasing out all the unwraps. Also, remember that ? is very powerful for short-circuiting out of error situations.

xrl avatar Mar 05 '22 21:03 xrl