-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Conversation
c50a4a2
to
48e1481
Compare
Codecov ReportBase: 45.64% // Head: 45.65% // Increases project coverage by
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
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. |
There was a problem hiding this 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.
controller/appcontroller.go
Outdated
@@ -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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return fmt.Errorf("error while finalizing the project deletion: %w", err) | |
return fmt.Errorf("error listing applications: %w", err) |
controller/appcontroller.go
Outdated
@@ -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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return fmt.Errorf("error while removing cascade finalizer: %w", err) | |
return fmt.Errorf("error getting project: %w", err) |
controller/appcontroller.go
Outdated
@@ -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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return fmt.Errorf("error while setting the operation state: %w", err) | |
return fmt.Errorf("error marshaling json: %w", err) |
controller/appcontroller.go
Outdated
} | ||
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return fmt.Errorf("error while setting the operation state: %w", err) | |
return fmt.Errorf("error merging operation state patch: %w", err) |
controller/appcontroller.go
Outdated
@@ -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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return fmt.Errorf("error while setting the operation state: %w", err) | |
return fmt.Errorf("error patching application with operation state: %w", err) |
controller/state.go
Outdated
@@ -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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return fmt.Errorf("error while saving the revision history: %w", err) | |
return fmt.Errorf("error marshaling revision history patch: %w", err) |
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>
91eaa36
to
a76d159
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, thanks @apoorvam1!
* 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>
* 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>
* 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>
* 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>
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: