My application kept crashing due to panics when the broadlink device was temporary unavailable. I refactored all .expect calls to .map_err to return string errors for all errors. The original error is appended to still be able to determine the root cause.
Would probably be better to use an Error type instead to be able to reason about the origin of the error programmatically and prevent allocation of strings when the error is not displayed.
Don't really have a use-case for that now though, so strings are fine.
My application kept crashing due to panics when the broadlink device was temporary unavailable. I refactored all
.expect
calls to.map_err
to return string errors for all errors. The original error is appended to still be able to determine the root cause.Would probably be better to use an Error type instead to be able to reason about the origin of the error programmatically and prevent allocation of strings when the error is not displayed. Don't really have a use-case for that now though, so strings are fine.