Skip to content

refactor: replace unwrap() with proper error handling in libwayshot#294

Merged
Decodetalkers merged 2 commits intowaycrate:mainfrom
0xsamalt:refactor/remove-unwraps
Feb 16, 2026
Merged

refactor: replace unwrap() with proper error handling in libwayshot#294
Decodetalkers merged 2 commits intowaycrate:mainfrom
0xsamalt:refactor/remove-unwraps

Conversation

@0xsamalt
Copy link
Contributor

Changes I have made:

  • Replaced try_into().unwrap() with a match statement in dispatch.rs to gracefully handle malformed data from the compositor.
  • Converted Card::open to return a std::io::Result<Self> and updated its call sites (including lib.rs)
  • I have refactored the internal format handling to use direct indexing (state.formats[0]) where values are guaranteed, reducing the reliance on unwrap() while maintaining intended fail-fast behavior for logic bugs.

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 0% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 16.43%. Comparing base (6f57056) to head (a4252a8).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
libwayshot/src/dispatch.rs 0.00% 15 Missing ⚠️
libwayshot/src/lib.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #294      +/-   ##
==========================================
- Coverage   16.48%   16.43%   -0.05%     
==========================================
  Files          17       17              
  Lines        3197     3206       +9     
==========================================
  Hits          527      527              
- Misses       2670     2679       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Decodetalkers
Copy link
Collaborator

Thank you!

@Decodetalkers Decodetalkers merged commit 25b2bcb into waycrate:main Feb 16, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants