sdk
sdk copied to clipboard
SM-998: Throw errors on Failed Project or Secret Deletion
Type of change
- [ ] Bug fix
- [ ] New feature development
- [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
- [ ] Build/deploy pipeline (DevOps)
- [x] Other
Objective
Throw errors when a project or a secret can't be deleted via the API.
Note: The SDK allows passing multiple project or secret id's for deletion. In the case that some fail and some are successful, the same Response contract is followed, but the success is false, data is None, and the error message contains the failed id's. The id's not returned in that list were deleted successfully.
Example: ResponseForProjectsDeleteResponse(success=False, data=None, error_message='Received error messages from the API: [(a932e83f-6a7f-4f5f-abd5-b09e013fa78d, "access denied")]')
Code changes
- crates/bitwarden/src/error.rs: Add a new Error type for ApiError
- crates/bitwarden/src/secrets_manager/projects/delete.rs: Throw errors if there are API errors from Project deletion
- crates/bitwarden/src/secrets_manager/secrets/delete.rs: Throw errors if there are API errors from Secret deletion
Before you submit
- Please add unit tests where it makes sense to do so (encouraged but not required)