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

Improving error handling #92

Merged
merged 1 commit into from
May 16, 2019
Merged

Improving error handling #92

merged 1 commit into from
May 16, 2019

Conversation

robscott
Copy link
Contributor

There were a number of places where errors were not being logged or displayed, this should fix a bunch of them.

@robscott robscott requested a review from rbren May 16, 2019 19:44
return err
}
specs := regexp.MustCompile("\n-+\n").Split(string(contents), -1)
for _, spec := range specs {
err = addYaml(spec)
if err != nil {
logrus.Errorf("Error parsing YAML %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI this error will be logged twice (once in addYaml), but maybe for the best

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that was intentional. I wanted to have more specific logging in addYaml but also add this as a failsafe if an error hadn't already gotten logged there. It will likely be repetitive if they run into an error, but does ensure we catch things added to addYaml in the future that may not get the same kind of logging in the future. I don't know, that could be overkill.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 sounds good to me

@@ -89,10 +89,18 @@ func main() {
if *webhook {
startWebhookServer(c, *disableWebhookConfigInstaller, *webhookPort)
} else if *dashboard {
k, _ := kube.CreateResourceProvider(*auditPath)
k, err := kube.CreateResourceProvider(*auditPath)
Copy link
Contributor

Choose a reason for hiding this comment

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

These will get logged twice as well.

@robscott robscott merged commit 1194c8b into master May 16, 2019
@robscott robscott deleted the rs/better-error-handling branch May 16, 2019 21:22
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