Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Sep 16, 2019. It is now read-only.

Conversation

@ideahitme
Copy link
Contributor

No description provided.

@ideahitme
Copy link
Contributor Author

πŸ‘

@ideahitme
Copy link
Contributor Author

πŸ‘

consumers/aws.go Outdated
func (a *awsConsumer) syncPerHostedZone(kubeRecords []*route53.ResourceRecordSet, zoneID string) error {
existingRecords, err := a.client.ListRecordSets(zoneID)
if err != nil {
log.Errorf("failed to list records in zoneID:%s. Error: %v", zoneID, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: space after colon

case len(ing.Status.LoadBalancer.Ingress) == 0:
return fmt.Errorf(
"[Ingress] The load balancer of ingress '%s/%s' does not have any ingress.",
"[Ingress] The load balancer field of ingress '%s/%s' is empty",
Copy link
Contributor

Choose a reason for hiding this comment

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

πŸ‘

case len(svc.Status.LoadBalancer.Ingress) == 0:
return fmt.Errorf(
"[Service] The load balancer of service '%s/%s' does not have any ingress.",
"[Service] The load balancer field of service '%s/%s' is empty",
Copy link
Contributor

Choose a reason for hiding this comment

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

πŸ‘ this message was very confusing

@hjacobs
Copy link
Contributor

hjacobs commented Mar 15, 2017

LGTM

@linki
Copy link
Owner

linki commented Mar 15, 2017

πŸ‘

@ideahitme
Copy link
Contributor Author

πŸ‘

@ideahitme ideahitme merged commit 8f1b3e3 into master Mar 15, 2017
@ideahitme ideahitme deleted the hotfix/handle-endpoints-conversion-fail branch March 15, 2017 09:02
kubeRecords, err := a.endpointsToRecords(endpoints)
if err != nil {
log.Errorf("failed to convert endpoints to RRS: %v. Aborting sync...", err)
return err
Copy link
Collaborator

Choose a reason for hiding this comment

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

In general errors should either be logged or returned, but not both.

To quote Dave Cheney:

If you choose to handle the error by logging it, by definition it’s not an error any more β€” you handled it. The act of logging an error handles the error, hence it is no longer appropriate to log it as an 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.

yes, totally make sense. Initially I wanted to print debug message, but I thought debug is not relevant here either. If error is not logged here with additional message, then it is a bit difficult to figure where the flow is aborted

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would wrap the returned error in fmt.Errorf with the same text from the log, and then have the caller log it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yup, there are few other places where it needs to be changed, but probably will do it in next PR

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants