Files
RedBear-OS/local
vasilito 3c90858e18 daemons: replace last_err.unwrap() and unreachable!() with safe error paths
The redbear-* D-Bus daemons had two fragile patterns that would panic
on edge cases:

1. The connection-retry loop in daemon main.rs files used
   'last_err.unwrap()' after the loop exhausted. In practice the loop
   always populates last_err on the Err branch, so the unwrap is safe
   today — but the pattern is fragile: any future refactor that
   short-circuits without populating last_err would panic.

   Replace this with 'return Err(err.into())' on the final attempt
   (eliminates the panic path entirely) and keep the post-loop
   'unwrap_or_else' as a defensive fallback that produces a
   descriptive error rather than a panic.

   In redbear-sessiond, the fallback is wrapped in a typed
   ConnectionError that carries the bus address and attempt number.

2. redbear-udisks/src/inventory.rs::hex_char() used 'unreachable!'
   for an out-of-range nibble. A bug at the caller would crash the
   daemon. Replace with the safe fallback '?' character (matches
   the conventional hex encoder behavior).

Verified by host cargo check on all four daemons.
2026-07-27 11:40:04 +09:00
..