Skip to content

refactor(watch-only): replace unwraps with typed errors and logging#934

Open
alienx5499 wants to merge 1 commit intogetfloresta:masterfrom
alienx5499:feat/463-watch-error-handling-core
Open

refactor(watch-only): replace unwraps with typed errors and logging#934
alienx5499 wants to merge 1 commit intogetfloresta:masterfrom
alienx5499:feat/463-watch-error-handling-core

Conversation

@alienx5499
Copy link
Copy Markdown

Description and Notes

This PR improves error handling in crates/floresta-watch-only by removing panic-prone unwrap/expect paths and replacing them with typed errors, guarded handling, and contextual logging.

Main changes:

  • Add thiserror based WatchOnlyError and KvDatabaseError
  • Add WatchOnlyError::Descriptor(String) and propagate descriptor parsing/derivation errors
  • Replace panic paths in block/mempool/cache logic with safe Option handling and error! logs
  • Replace several DB layer unwraps with safe handling in kv_database
  • Add unit test for invalid descriptor error path

Related issues: #463, #86

How to verify the changes you have done?

From repo root:

cargo +nightly fmt -p floresta-watch-only
cargo test -p floresta-watch-only
cargo clippy -p floresta-watch-only --all-targets --all-features -- -D warnings

Note: Overlaps #931 slightly in maybe_derive_addresses (lib.rs); easy resolve after #931 is on master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant