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

Don't ignore errors in UI API Layer #2581

Merged
merged 3 commits into from Feb 7, 2019

Conversation

tgorgol
Copy link
Contributor

@tgorgol tgorgol commented Feb 5, 2019

Description

Changes proposed in this pull request:

  • Add errcheck tool to ui-api-layer and ui-api-layer acceptance tests before-commit.sh
  • Handle errors detected by errcheck

Related issue(s)

#2113 #2587

@tgorgol tgorgol added kind/bug Categorizes issue or PR as related to a bug. area/busola Related to all activities around the Busola UI and all its views labels Feb 5, 2019
@tgorgol tgorgol added this to the Sprint_Wookiee_11 milestone Feb 5, 2019
@tgorgol tgorgol self-assigned this Feb 5, 2019
@tgorgol tgorgol added the WIP label Feb 5, 2019
@tgorgol tgorgol mentioned this pull request Feb 5, 2019
@tgorgol tgorgol removed the WIP label Feb 5, 2019
fmt.Fprintln(w, data)
_, err := fmt.Fprintln(w, data)
if err != nil {
glog.Warningf("Unable to write response body. Cause: %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.

log as an error

body.Close()
err := iosafety.DrainReader(body)
if err != nil {
glog.Warningf("Unable to drain body reader. Cause: %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.

maybe it would be good to return these errors. If this is not an option, log them with error level

flag.Set("stderrthreshold", "INFO")
err := flag.Set("stderrthreshold", "INFO")
if err != nil {
glog.Error(errors.Wrap(err, "while parsing flags"))
Copy link
Contributor

Choose a reason for hiding this comment

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

Please consider glog.Fatal- but it's totally up to you

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I decided that the error occurring during setting that flag wasn't critical because it wasn't really related to parsing user provided flags and that logging the error without exiting the application would suffice.

Copy link
Contributor

@pkosiec pkosiec left a comment

Choose a reason for hiding this comment

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

Great work.

@tgorgol tgorgol merged commit b5be5d6 into kyma-project:master Feb 7, 2019
@tgorgol tgorgol deleted the check-errors-ui-api-layer branch February 7, 2019 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/busola Related to all activities around the Busola UI and all its views kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants