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

chore: wrap errors with message (#10592) #10986

Merged
merged 4 commits into from
Oct 19, 2022

Conversation

apoorvam1
Copy link
Contributor

@apoorvam1 apoorvam1 commented Oct 18, 2022

Signed-off-by: Apoorva Mahabaleshwara apoorvambhat@gmail.com
Note on DCO:

If the DCO action in the integration test fails, one or more of your commits are not signed off. Please click on the Details link next to the DCO action for instructions on how to resolve this.

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • Optional. My organization is added to USERS.md.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).

@apoorvam1 apoorvam1 force-pushed the issue-10592 branch 2 times, most recently from c50a4a2 to 48e1481 Compare October 18, 2022 18:41
@codecov
Copy link

codecov bot commented Oct 18, 2022

Codecov Report

Base: 45.64% // Head: 45.65% // Increases project coverage by +0.01% 🎉

Coverage data is based on head (86d1254) compared to base (8a71b8a).
Patch coverage: 15.62% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10986      +/-   ##
==========================================
+ Coverage   45.64%   45.65%   +0.01%     
==========================================
  Files         237      237              
  Lines       28729    28738       +9     
==========================================
+ Hits        13114    13121       +7     
- Misses      13810    13811       +1     
- Partials     1805     1806       +1     
Impacted Files Coverage Δ
cmd/argocd/commands/root.go 5.88% <0.00%> (ø)
controller/appcontroller.go 51.78% <0.00%> (ø)
controller/state.go 72.58% <0.00%> (ø)
cmd/argocd/commands/version.go 38.14% <20.00%> (+4.05%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@crenshaw-dev crenshaw-dev left a comment

Choose a reason for hiding this comment

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

Thanks @apoorvam1! Added some suggestions. Usually it's best to have the error message describe the action taken immediately before the error.

@@ -907,7 +907,7 @@ func (ctrl *ApplicationController) processProjectQueueItem() (processNext bool)
func (ctrl *ApplicationController) finalizeProjectDeletion(proj *appv1.AppProject) error {
apps, err := ctrl.appLister.Applications(ctrl.namespace).List(labels.Everything())
if err != nil {
return err
return fmt.Errorf("error while finalizing the project deletion: %w", err)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return fmt.Errorf("error while finalizing the project deletion: %w", err)
return fmt.Errorf("error listing applications: %w", err)

@@ -1077,7 +1077,7 @@ func (ctrl *ApplicationController) finalizeApplicationDeletion(app *appv1.Applic
func (ctrl *ApplicationController) removeCascadeFinalizer(app *appv1.Application) error {
_, err := ctrl.getAppProj(app)
if err != nil {
return err
return fmt.Errorf("error while removing cascade finalizer: %w", err)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return fmt.Errorf("error while removing cascade finalizer: %w", err)
return fmt.Errorf("error getting project: %w", err)

@@ -1256,12 +1256,12 @@ func (ctrl *ApplicationController) setOperationState(app *appv1.Application, sta
}
patchJSON, err := json.Marshal(patch)
if err != nil {
return err
return fmt.Errorf("error while setting the operation state: %w", err)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return fmt.Errorf("error while setting the operation state: %w", err)
return fmt.Errorf("error marshaling json: %w", err)

}
if app.Status.OperationState != nil && app.Status.OperationState.FinishedAt != nil && state.FinishedAt == nil {
patchJSON, err = jsonpatch.MergeMergePatches(patchJSON, []byte(`{"status": {"operationState": {"finishedAt": null}}}`))
if err != nil {
return err
return fmt.Errorf("error while setting the operation state: %w", err)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return fmt.Errorf("error while setting the operation state: %w", err)
return fmt.Errorf("error merging operation state patch: %w", err)

@@ -1272,7 +1272,7 @@ func (ctrl *ApplicationController) setOperationState(app *appv1.Application, sta
if apierr.IsNotFound(err) {
return nil
}
return err
return fmt.Errorf("error while setting the operation state: %w", err)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return fmt.Errorf("error while setting the operation state: %w", err)
return fmt.Errorf("error patching application with operation state: %w", err)

@@ -659,7 +659,7 @@ func (m *appStateManager) persistRevisionHistory(app *v1alpha1.Application, revi
},
})
if err != nil {
return err
return fmt.Errorf("error while saving the revision history: %w", err)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return fmt.Errorf("error while saving the revision history: %w", err)
return fmt.Errorf("error marshaling revision history patch: %w", err)

@crenshaw-dev crenshaw-dev changed the title issue-10592 Wrap errors with message chore: wrap errors with message (#10592) Oct 19, 2022
Apoorva Mahabaleshwara and others added 3 commits October 19, 2022 08:57
Signed-off-by: Apoorva Mahabaleshwara <apoorvamahabaleshwara@Apoorvas-MBP.attlocal.net>
Signed-off-by: Apoorva Mahabaleshwara <apoorvambhat@gmail.com>
Signed-off-by: Apoorva Mahabaleshwara <apoorvamahabaleshwara@Apoorvas-MBP.attlocal.net>
Signed-off-by: Apoorva Mahabaleshwara <apoorvambhat@gmail.com>
Signed-off-by: Apoorva Mahabaleshwara <apoorvambhat@gmail.com>
Copy link
Member

@crenshaw-dev crenshaw-dev left a comment

Choose a reason for hiding this comment

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

lgtm, thanks @apoorvam1!

@crenshaw-dev crenshaw-dev enabled auto-merge (squash) October 19, 2022 18:19
@crenshaw-dev crenshaw-dev merged commit 92abb56 into argoproj:master Oct 19, 2022
nsinghal12 pushed a commit to nsinghal12/argo-cd that referenced this pull request Oct 20, 2022
* issue-10592 Wrap errors with message

Signed-off-by: Apoorva Mahabaleshwara <apoorvamahabaleshwara@Apoorvas-MBP.attlocal.net>
Signed-off-by: Apoorva Mahabaleshwara <apoorvambhat@gmail.com>

* issue-10592 remove unwanted error  wrappers

Signed-off-by: Apoorva Mahabaleshwara <apoorvamahabaleshwara@Apoorvas-MBP.attlocal.net>
Signed-off-by: Apoorva Mahabaleshwara <apoorvambhat@gmail.com>

* chore: fix  error wrapper messages

Signed-off-by: Apoorva Mahabaleshwara <apoorvambhat@gmail.com>

Signed-off-by: Apoorva Mahabaleshwara <apoorvamahabaleshwara@Apoorvas-MBP.attlocal.net>
Signed-off-by: Apoorva Mahabaleshwara <apoorvambhat@gmail.com>
Co-authored-by: Apoorva Mahabaleshwara <apoorvamahabaleshwara@Apoorvas-MBP.attlocal.net>
Signed-off-by: Niti Singhal <gupta.sweet.niti@gmail.com>
emirot pushed a commit to emirot/argo-cd that referenced this pull request Oct 21, 2022
* issue-10592 Wrap errors with message

Signed-off-by: Apoorva Mahabaleshwara <apoorvamahabaleshwara@Apoorvas-MBP.attlocal.net>
Signed-off-by: Apoorva Mahabaleshwara <apoorvambhat@gmail.com>

* issue-10592 remove unwanted error  wrappers

Signed-off-by: Apoorva Mahabaleshwara <apoorvamahabaleshwara@Apoorvas-MBP.attlocal.net>
Signed-off-by: Apoorva Mahabaleshwara <apoorvambhat@gmail.com>

* chore: fix  error wrapper messages

Signed-off-by: Apoorva Mahabaleshwara <apoorvambhat@gmail.com>

Signed-off-by: Apoorva Mahabaleshwara <apoorvamahabaleshwara@Apoorvas-MBP.attlocal.net>
Signed-off-by: Apoorva Mahabaleshwara <apoorvambhat@gmail.com>
Co-authored-by: Apoorva Mahabaleshwara <apoorvamahabaleshwara@Apoorvas-MBP.attlocal.net>
Signed-off-by: emirot <emirot.nolan@gmail.com>
crenshaw-dev added a commit that referenced this pull request Oct 21, 2022
* chore: wrap errors with message (#10592) (#10986)

* issue-10592 Wrap errors with message

Signed-off-by: Apoorva Mahabaleshwara <apoorvamahabaleshwara@Apoorvas-MBP.attlocal.net>
Signed-off-by: Apoorva Mahabaleshwara <apoorvambhat@gmail.com>

* issue-10592 remove unwanted error  wrappers

Signed-off-by: Apoorva Mahabaleshwara <apoorvamahabaleshwara@Apoorvas-MBP.attlocal.net>
Signed-off-by: Apoorva Mahabaleshwara <apoorvambhat@gmail.com>

* chore: fix  error wrapper messages

Signed-off-by: Apoorva Mahabaleshwara <apoorvambhat@gmail.com>

Signed-off-by: Apoorva Mahabaleshwara <apoorvamahabaleshwara@Apoorvas-MBP.attlocal.net>
Signed-off-by: Apoorva Mahabaleshwara <apoorvambhat@gmail.com>
Co-authored-by: Apoorva Mahabaleshwara <apoorvamahabaleshwara@Apoorvas-MBP.attlocal.net>
Signed-off-by: emirot <emirot.nolan@gmail.com>

* test: simplify test

Signed-off-by: emirot <nolan.emirot@workday.com>
Signed-off-by: emirot <emirot.nolan@gmail.com>

* trigger ci

Signed-off-by: emirot <emirot.nolan@gmail.com>

* feat: sort resource list by created_at, add message to AnalysisRun and replicas to ReplicaSet (#10613)

* Misc UI Improvements: sort by created at in resource list view, add message to AnalysisRun and replicas to Replicaset

Signed-off-by: Alex Eftimie <alex.eftimie@getyourguide.com>

* Address PR comments

Signed-off-by: Alex Eftimie <alex.eftimie@getyourguide.com>

* No underscore needed in created_at. Add space between icon and message in health details for non-controlled resources

Signed-off-by: Alex Eftimie <alex.eftimie@getyourguide.com>

* Guard section

Signed-off-by: Alex Eftimie <alex.eftimie@getyourguide.com>

Signed-off-by: Alex Eftimie <alex.eftimie@getyourguide.com>
Co-authored-by: Remington Breeze <remington@breeze.software>
Signed-off-by: emirot <emirot.nolan@gmail.com>

* chore: fix e2e (#11005)

* chore: fix e2e

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* more config

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* global

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Signed-off-by: emirot <emirot.nolan@gmail.com>

Signed-off-by: Apoorva Mahabaleshwara <apoorvamahabaleshwara@Apoorvas-MBP.attlocal.net>
Signed-off-by: Apoorva Mahabaleshwara <apoorvambhat@gmail.com>
Signed-off-by: emirot <emirot.nolan@gmail.com>
Signed-off-by: emirot <nolan.emirot@workday.com>
Signed-off-by: Alex Eftimie <alex.eftimie@getyourguide.com>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: apoorvam1 <apoorvambhat@gmail.com>
Co-authored-by: Apoorva Mahabaleshwara <apoorvamahabaleshwara@Apoorvas-MBP.attlocal.net>
Co-authored-by: emirot <nolan.emirot@workday.com>
Co-authored-by: Alex Eftimie <alex.eftimie@getyourguide.com>
Co-authored-by: Remington Breeze <remington@breeze.software>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
emirot added a commit to emirot/argo-cd that referenced this pull request Jan 27, 2023
* chore: wrap errors with message (argoproj#10592) (argoproj#10986)

* issue-10592 Wrap errors with message

Signed-off-by: Apoorva Mahabaleshwara <apoorvamahabaleshwara@Apoorvas-MBP.attlocal.net>
Signed-off-by: Apoorva Mahabaleshwara <apoorvambhat@gmail.com>

* issue-10592 remove unwanted error  wrappers

Signed-off-by: Apoorva Mahabaleshwara <apoorvamahabaleshwara@Apoorvas-MBP.attlocal.net>
Signed-off-by: Apoorva Mahabaleshwara <apoorvambhat@gmail.com>

* chore: fix  error wrapper messages

Signed-off-by: Apoorva Mahabaleshwara <apoorvambhat@gmail.com>

Signed-off-by: Apoorva Mahabaleshwara <apoorvamahabaleshwara@Apoorvas-MBP.attlocal.net>
Signed-off-by: Apoorva Mahabaleshwara <apoorvambhat@gmail.com>
Co-authored-by: Apoorva Mahabaleshwara <apoorvamahabaleshwara@Apoorvas-MBP.attlocal.net>
Signed-off-by: emirot <emirot.nolan@gmail.com>

* test: simplify test

Signed-off-by: emirot <nolan.emirot@workday.com>
Signed-off-by: emirot <emirot.nolan@gmail.com>

* trigger ci

Signed-off-by: emirot <emirot.nolan@gmail.com>

* feat: sort resource list by created_at, add message to AnalysisRun and replicas to ReplicaSet (argoproj#10613)

* Misc UI Improvements: sort by created at in resource list view, add message to AnalysisRun and replicas to Replicaset

Signed-off-by: Alex Eftimie <alex.eftimie@getyourguide.com>

* Address PR comments

Signed-off-by: Alex Eftimie <alex.eftimie@getyourguide.com>

* No underscore needed in created_at. Add space between icon and message in health details for non-controlled resources

Signed-off-by: Alex Eftimie <alex.eftimie@getyourguide.com>

* Guard section

Signed-off-by: Alex Eftimie <alex.eftimie@getyourguide.com>

Signed-off-by: Alex Eftimie <alex.eftimie@getyourguide.com>
Co-authored-by: Remington Breeze <remington@breeze.software>
Signed-off-by: emirot <emirot.nolan@gmail.com>

* chore: fix e2e (argoproj#11005)

* chore: fix e2e

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* more config

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* global

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Signed-off-by: emirot <emirot.nolan@gmail.com>

Signed-off-by: Apoorva Mahabaleshwara <apoorvamahabaleshwara@Apoorvas-MBP.attlocal.net>
Signed-off-by: Apoorva Mahabaleshwara <apoorvambhat@gmail.com>
Signed-off-by: emirot <emirot.nolan@gmail.com>
Signed-off-by: emirot <nolan.emirot@workday.com>
Signed-off-by: Alex Eftimie <alex.eftimie@getyourguide.com>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: apoorvam1 <apoorvambhat@gmail.com>
Co-authored-by: Apoorva Mahabaleshwara <apoorvamahabaleshwara@Apoorvas-MBP.attlocal.net>
Co-authored-by: emirot <nolan.emirot@workday.com>
Co-authored-by: Alex Eftimie <alex.eftimie@getyourguide.com>
Co-authored-by: Remington Breeze <remington@breeze.software>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Signed-off-by: emirot <emirot.nolan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants