Repository navigation
refactor: log context for errors instead of discarding them - #329
Open
blind-dev-azhasys wants to merge 2 commits into
Open
blind-dev-azhasys wants to merge 2 commits into
blind-dev-azhasys wants to merge 2 commits into
Conversation
… them Replace .or(Err(...))? patterns in the btleplug manager and connection with match/let-else statements that record the underlying error with tracing before returning the typed Error, so failures are traceable. Part of linux-credentials#14.
Replace remaining .or(Err(...))? patterns: pxp BLE discovery and CTAP response forwarding now log with tracing before returning; ctap1 parsing sites use map_err so the original error is included in the IOError. Part of linux-credentials#14.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Log context for transport/protocol errors instead of discarding them
Part of #14.
What
Replaces the
.or(Err(...))?error-handling pattern, which silentlydiscarded the underlying error, with forms that record context using
tracingbefore returning the typed error — following the approachsuggested in #14:
manager.rs,connection.rs): everyResult-returning btleplug call (adapter events, scans, peripheralconnect/discover/read/write, notification subscription, GATT UUID
parsing) now logs the underlying btleplug error with
error!beforereturning
Error::{Unavailable,ConnectionFailed,OperationFailed,InvalidFraming}.pxp/src/ble.rs,pxp/src/protocol.rs): BLE discovery and CTAPresponse forwarding log before returning
PxpError.proto/ctap1/protocol.rs): APDU status/response parsing andthe user-presence wait now log before returning
CtapError::Other/UserActionTimeout.ctap1/model.rs,ctap1/apdu/response.rs,ble/framing.rs): switched from.or(Err(IOError::new(...)))to.map_err(...)so the original error is included in theIOErrormessage instead of being dropped.
No behavioral changes beyond logging and richer
IOErrormessages; allreturned error variants are unchanged.
Validation
cargo clippy --workspace --all-features: clean (only pre-existingmanifest warnings about unused dev-dependencies).
cargo fmt: clean.cargo test --workspace: all tests pass (544 in libwebauthn pluspxp/libwebauthn-tests suites).