omi icon indicating copy to clipboard operation
omi copied to clipboard

Rust device SDK enhancement: expose wrapped errors through Error::source

Open Kgruben0133 opened this issue 2 months ago • 2 comments

At 9ff63a63b047ec756b6a4e3d726bac5bf5d6440e, sdks/rust/omi-device/src/lib.rs defines OmiError::Transport(E) and OmiError::Protocol(ProtocolError), but its std::error::Error implementation is empty. A caller traversing Error::source() therefore cannot access or downcast the wrapped cause, even though the wrapper's Display currently includes that cause's text.

This is a diagnostics enhancement, not a claim that the current error implementation is invalid. I propose one small PR exposing the cause for both variants and documenting a consistent display/chaining contract. Rust's Error documentation cautions against displaying the cause twice when also returning it through source(); the change should account for that instead of simply adding redundant chain text. Tests should exercise both variants through &dyn Error and verify the documented display output.

@josancamon19 — would you sponsor this improvement for US$20, payable through the documented PayPal process after acceptance and merge? This is only a requested bounty. Source inspected; no Rust compiler, hardware test, test-suite pass, or repository-preflight pass is claimed. AI-assisted proposal on behalf of @Kgruben0133.

Kgruben0133 avatar Sep 08 '26 15:09 Kgruben0133

/claim #13142

Submitted implementation and unit tests in PR #13317.

CreamPle avatar Sep 09 '26 13:09 CreamPle

Thanks for putting this together. We aren't doing bounties at the moment, so we're closing the bounty proposal issues for now — thanks for the fix! 🙏

aryanorastar avatar Nov 05 '26 16:11 aryanorastar