[PM-33561] debt: Wire CipherManager and cipher ViewModel error handlers#6651
[PM-33561] debt: Wire CipherManager and cipher ViewModel error handlers#6651SaintPatrck merged 3 commits intomainfrom
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #6651 +/- ##
==========================================
- Coverage 85.80% 85.77% -0.03%
==========================================
Files 848 805 -43
Lines 58851 57257 -1594
Branches 8351 8329 -22
==========================================
- Hits 50497 49114 -1383
+ Misses 5455 5244 -211
Partials 2899 2899
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
New Issues (1)Checkmarx found the following issues in this Pull Request
|
|
Claude finished @SaintPatrck's task in 4m 38s —— View job I'll analyze this and get back to you. |
a63268e to
f25b532
Compare
|
IMPORTANT (Correctness): // VaultViewModel.kt:1019-1022 (current)
dialog = VaultState.DialogState.Error(
title = BitwardenString.an_error_has_occurred.asText(),
message = BitwardenString.unable_to_archive_selected_item.asText(), // <-- missing errorMessage check
error = result.error,
)
// Suggested fix (same pattern as SearchViewModel, VaultItemListingViewModel, etc.):
dialog = VaultState.DialogState.Error(
title = BitwardenString.an_error_has_occurred.asText(),
message = result.errorMessage?.asText()
?: BitwardenString.unable_to_archive_selected_item.asText(),
error = result.error,
)Same issue applies to |
| ): ArchiveCipherResult { | ||
| val userId = activeUserId ?: return ArchiveCipherResult.Error(NoActiveUserException()) | ||
| val userId = activeUserId | ||
| ?: return ArchiveCipherResult.Error(error = NoActiveUserException()) |
There was a problem hiding this comment.
Why did this change?
There was a problem hiding this comment.
Leftover from adding errorMessage because I originally added it as the first param so the param name had to be added. Just forgot to revert these two spots.
They're minor changes and we usually declare param names anyways. Unless you feel strongly about leaving it as it was, I think this actually keeps things more consistent with the rest of the code.
| ): UnarchiveCipherResult { | ||
| val userId = activeUserId ?: return UnarchiveCipherResult.Error(NoActiveUserException()) | ||
| val userId = activeUserId | ||
| ?: return UnarchiveCipherResult.Error(error = NoActiveUserException()) |
There was a problem hiding this comment.
Wire userFriendlyMessage through CipherManager fold(onFailure) blocks for delete, restore, share, archive, unarchive, and attachment operations. Update all cipher-related ViewModel error handlers to prefer errorMessage over generic defaults.
f25b532 to
8cd25ef
Compare
Code Review Summary (Updated)PR: PM-33394 debt: Wire CipherManager and cipher ViewModel error handlers OverviewThis PR wires Previous Review CorrectionThe prior automated review incorrectly reported that FindingsNo issues found. The PR is clean. What Looks Good
|
app/src/main/kotlin/com/x8bit/bitwarden/data/vault/repository/model/CreateCipherResult.kt
Outdated
Show resolved
Hide resolved
app/src/main/kotlin/com/x8bit/bitwarden/data/vault/repository/model/UpdateCipherResult.kt
Outdated
Show resolved
Hide resolved
Code Review Summary (Re-review)PR: PM-33561 debt: Wire CipherManager and cipher ViewModel error handlers Reviewed commits: All 3 commits through ff0a5e5 (including 2 new commits since last review) Changes Since Last ReviewTwo follow-up commits refined the approach by moving userFriendlyMessage derivation from CipherManagerImpl call sites into the result type constructors as default values:
FindingsNo issues found. The refactoring is clean and well-executed. Verification Notes
|


🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-33561
📔 Objective
Wire
userFriendlyMessagethrough CipherManagerfold(onFailure)blocks and update all cipher-related ViewModel error handlers to prefererrorMessageover generic defaults.This is part of the PM-33394 series to surface
CookieRedirectExceptionuser-friendly messages through result types to ViewModels. The foundation (userFriendlyMessageextension anderrorMessageon result types) was merged in #6642.Changes:
userFriendlyMessagein CipherManager for delete, restore, share, archive, unarchive, and attachment operations