[PR #5362] [MERGED] [PM-21782] Improve create cipher error handling #5702

Closed
opened 2025-11-27 00:12:52 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/5362
Author: @SaintPatrck
Created: 6/13/2025
Status: Merged
Merged: 6/16/2025
Merged by: @SaintPatrck

Base: mainHead: PM-21782/propagate-create-cipher-error-message


📝 Commits (1)

  • 4a9cb19 [PM-21782] Improve create cipher error handling

📊 Changes

9 files changed (+320 additions, -33 deletions)

View changed files

📝 app/src/main/kotlin/com/x8bit/bitwarden/data/vault/manager/CipherManagerImpl.kt (+36 -12)
📝 app/src/main/kotlin/com/x8bit/bitwarden/data/vault/repository/model/CreateCipherResult.kt (+3 -2)
📝 app/src/main/kotlin/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditViewModel.kt (+5 -1)
📝 app/src/test/kotlin/com/x8bit/bitwarden/data/vault/manager/CipherManagerTest.kt (+117 -11)
📝 app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditViewModelTest.kt (+56 -1)
network/src/main/kotlin/com/bitwarden/network/model/CreateCipherResponseJson.kt (+32 -0)
📝 network/src/main/kotlin/com/bitwarden/network/service/CiphersService.kt (+3 -2)
📝 network/src/main/kotlin/com/bitwarden/network/service/CiphersServiceImpl.kt (+25 -2)
📝 network/src/test/kotlin/com/bitwarden/network/service/CiphersServiceTest.kt (+43 -2)

📄 Description

🎟️ Tracking

PM-21782

📔 Objective

This commit introduces a new CreateCipherResponseJson sealed class to better handle responses from the create cipher API endpoint. This allows for more specific error messages to be displayed to the user when a cipher creation fails due to invalid data.

The CreateCipherResult.Error class has been updated to include an optional errorMessage string, which can be directly displayed in the UI.

The CipherManagerImpl and VaultAddEditViewModel have been updated to utilize this new error handling, providing more informative feedback to the user.

📸 Screenshots

image

Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/bitwarden/android/pull/5362 **Author:** [@SaintPatrck](https://github.com/SaintPatrck) **Created:** 6/13/2025 **Status:** ✅ Merged **Merged:** 6/16/2025 **Merged by:** [@SaintPatrck](https://github.com/SaintPatrck) **Base:** `main` ← **Head:** `PM-21782/propagate-create-cipher-error-message` --- ### 📝 Commits (1) - [`4a9cb19`](https://github.com/bitwarden/android/commit/4a9cb1956b71e2ae29b639a489a92e01d9c766d4) [PM-21782] Improve create cipher error handling ### 📊 Changes **9 files changed** (+320 additions, -33 deletions) <details> <summary>View changed files</summary> 📝 `app/src/main/kotlin/com/x8bit/bitwarden/data/vault/manager/CipherManagerImpl.kt` (+36 -12) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/data/vault/repository/model/CreateCipherResult.kt` (+3 -2) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditViewModel.kt` (+5 -1) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/data/vault/manager/CipherManagerTest.kt` (+117 -11) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditViewModelTest.kt` (+56 -1) ➕ `network/src/main/kotlin/com/bitwarden/network/model/CreateCipherResponseJson.kt` (+32 -0) 📝 `network/src/main/kotlin/com/bitwarden/network/service/CiphersService.kt` (+3 -2) 📝 `network/src/main/kotlin/com/bitwarden/network/service/CiphersServiceImpl.kt` (+25 -2) 📝 `network/src/test/kotlin/com/bitwarden/network/service/CiphersServiceTest.kt` (+43 -2) </details> ### 📄 Description ## 🎟️ Tracking PM-21782 ## 📔 Objective This commit introduces a new `CreateCipherResponseJson` sealed class to better handle responses from the create cipher API endpoint. This allows for more specific error messages to be displayed to the user when a cipher creation fails due to invalid data. The `CreateCipherResult.Error` class has been updated to include an optional `errorMessage` string, which can be directly displayed in the UI. The `CipherManagerImpl` and `VaultAddEditViewModel` have been updated to utilize this new error handling, providing more informative feedback to the user. ## 📸 Screenshots <img width="285" alt="image" src="https://github.com/user-attachments/assets/a91522ab-5c62-477b-b664-c37f31221276" /> ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## 🦮 Reviewer guidelines <!-- Suggested interactions but feel free to use (or not) as you desire! --> - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹ️ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠️ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or ♻️ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-27 00:12:52 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#5702