Skip to content

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

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

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.

@moisesPompilio
Copy link
Copy Markdown
Collaborator

Closing this one because it seems to have been AI-generated

@alienx5499
Copy link
Copy Markdown
Author

@moisesPompilio
Could you share what specifically in the PR led to that impression?
I’d like to understand what stood out so I can improve future submissions

If you’re open to it, I can also break this into smaller, focused PRs with clearer scope and reasoning per change

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.

2 participants