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

Cleanup error handling in datastoresyncer #70

Merged
merged 3 commits into from
Jan 28, 2020

Conversation

tpantelis
Copy link
Contributor

@tpantelis tpantelis commented Jun 13, 2019

  • Propagate or log errors instead of calling Fatalf
  • Propagate errors for functions that return error
  • Improved logging messages where appropriate

Signed-off-by: Tom Pantelis tompantelis@gmail.com


This change is Reviewable

@tpantelis tpantelis requested a review from mangelajo June 13, 2019 11:50
@tpantelis
Copy link
Contributor Author

@skitt

}

for _, endpoint := range endpoints {
if !util.CompareEndpointSpec(endpoint.Spec, d.localEndpoint.Spec) {
endpointCrdName, err := util.GetEndpointCRDName(endpoint)
if err != nil {
klog.Errorf("Error while converting endpoint to CRD Name %s", endpoint.Spec.CableName)
break
klog.Errorf("error converting endpoint %#v to CRD Name: %v", endpoint, err)
Copy link
Member

Choose a reason for hiding this comment

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

What’s the reasoning here (and elsewhere in the loop) which leads to logging an error rather than returning the error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Originally I changed these sites to return error as well but I'm unsure as to the original intent. These are questions went thru my mind: Why was the error above fatal but not this one and the 2 below it... Why does it break here and not below... Are these errors catastrophic enough to propagate and thus exit the process... When deleting, would it return an error if the object doesn't exist... The latter 2 made me squeamish about changing the behavior.

Copy link
Member

Choose a reason for hiding this comment

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

@Oats87 what do you think?

mangelajo
mangelajo previously approved these changes Jul 18, 2019
@mangelajo
Copy link
Contributor

There are some conflicts now, sorry.

mangelajo
mangelajo previously approved these changes Sep 6, 2019
Copy link
Contributor

@mangelajo mangelajo left a comment

Choose a reason for hiding this comment

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

LGTM

@mangelajo
Copy link
Contributor

I will be merging this as it's just cleanup and I think it will benefit the upcoming release with better error logs.

- Propagate or log errors instead of calling Fatalf
- Propagate errors for functions that return error
- Improved logging messages where appropriate

Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
@submariner-bot
Copy link
Contributor

🤖 Created branch: z_pr70/tpantelis/datastoreresyncer

@mangelajo
Copy link
Contributor

@tpantelis I updated this one, I'm fine to merge it so we move it out of backlog at this point.

@tpantelis
Copy link
Contributor Author

@tpantelis I updated this one, I'm fine to merge it so we move it out of backlog at this point.

Thanks - I forgot about this one.

@tpantelis tpantelis merged commit 87b9209 into submariner-io:master Jan 28, 2020
@submariner-bot
Copy link
Contributor

🤖 Closed branches: [z_pr70/tpantelis/datastoreresyncer]

@tpantelis tpantelis deleted the datastoreresyncer branch January 28, 2020 15:19
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.

4 participants