Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add require! macro to include field information in MissingFields error #686

Merged
merged 4 commits into from
Apr 1, 2024

Conversation

dani-garcia
Copy link
Member

Type of change

- [ ] Bug fix
- [ ] New feature development
- [x] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
- [ ] Build/deploy pipeline (DevOps)
- [ ] Other

Objective

Previously the MissingFields error didn't contain any usable information, plus it was unwieldy to use. With the use of a simple macro we can improve the error messaging and also simplify the error handling code.

Copy link
Contributor

github-actions bot commented Mar 28, 2024

Logo
Checkmarx One – Scan Summary & Detailsf4504ee9-c5b1-43a1-aa13-bdc292437b6b

No New Or Fixed Issues Found

Copy link

codecov bot commented Mar 28, 2024

Codecov Report

Attention: Patch coverage is 17.50000% with 66 lines in your changes are missing coverage. Please review.

Project coverage is 60.49%. Comparing base (9cd9a15) to head (432bfc5).
Report is 1 commits behind head on main.

Files Patch % Lines
crates/bitwarden/src/platform/sync.rs 0.00% 12 Missing ⚠️
crates/bitwarden/src/vault/cipher/login.rs 0.00% 8 Missing ⚠️
crates/bitwarden/src/vault/send.rs 0.00% 7 Missing ⚠️
crates/bitwarden/src/auth/login/auth_request.rs 0.00% 5 Missing ⚠️
...n/src/secrets_manager/projects/project_response.rs 0.00% 5 Missing ⚠️
crates/bitwarden/src/admin_console/policy.rs 0.00% 4 Missing ⚠️
crates/bitwarden/src/vault/cipher/cipher.rs 0.00% 4 Missing ⚠️
crates/bitwarden/src/auth/login/password.rs 0.00% 3 Missing ⚠️
crates/bitwarden/src/platform/domain.rs 0.00% 3 Missing ⚠️
crates/bitwarden/src/auth/login/api_key.rs 0.00% 2 Missing ⚠️
... and 9 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #686      +/-   ##
==========================================
+ Coverage   60.41%   60.49%   +0.08%     
==========================================
  Files         171      171              
  Lines       10426    10384      -42     
==========================================
- Hits         6299     6282      -17     
+ Misses       4127     4102      -25     

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

# Conflicts:
#	crates/bitwarden/src/vault/cipher/login.rs
@dani-garcia dani-garcia marked this pull request as ready for review March 29, 2024 15:45
@dani-garcia dani-garcia requested a review from Hinton March 29, 2024 15:45
@@ -133,4 +133,14 @@ macro_rules! impl_bitwarden_error {
impl_bitwarden_error!(ApiError);
impl_bitwarden_error!(IdentityError);

macro_rules! require {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add some documentation here.

@dani-garcia dani-garcia requested a review from Hinton April 1, 2024 14:07
@dani-garcia dani-garcia merged commit 0b3f175 into main Apr 1, 2024
74 checks passed
@dani-garcia dani-garcia deleted the ps/missing-fields-named branch April 1, 2024 14:55
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