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

fix(logging): do not panic in library code #3076

Merged
merged 13 commits into from Oct 29, 2020
Merged

fix(logging): do not panic in library code #3076

merged 13 commits into from Oct 29, 2020

Conversation

@0xSage
Copy link
Contributor

@0xSage 0xSage commented Oct 23, 2020

fixes: #1862

Changes:

  • No longer panic on User introduced errors. Instead we log the error and let program proceed
  • We log.Fatalf("ptypes.TimestampProto(time.Unix(0,0)) failed: %v", err) to exit program, since it's a fatal error/likely not induced by Users
@gcf-merge-on-green
Copy link
Contributor

@gcf-merge-on-green gcf-merge-on-green bot commented Oct 23, 2020

Your PR has attempted to merge for 3 hours. Please check that all required checks have passed, you have an automerge label, and that all your reviewers have approved the PR

@gcf-merge-on-green
Copy link
Contributor

@gcf-merge-on-green gcf-merge-on-green bot commented Oct 23, 2020

Merge-on-green attempted to merge your PR for 6 hours, but it was not mergeable because either one of your required status checks failed, or one of your required reviews was not approved. Learn more about your required status checks here: https://help.github.com/en/github/administering-a-repository/enabling-required-status-checks. You can remove and reapply the label to re-run the bot.

1 similar comment
@gcf-merge-on-green
Copy link
Contributor

@gcf-merge-on-green gcf-merge-on-green bot commented Oct 23, 2020

Merge-on-green attempted to merge your PR for 6 hours, but it was not mergeable because either one of your required status checks failed, or one of your required reviews was not approved. Learn more about your required status checks here: https://help.github.com/en/github/administering-a-repository/enabling-required-status-checks. You can remove and reapply the label to re-run the bot.

logging/logging.go Outdated Show resolved Hide resolved
logging/logging.go Outdated Show resolved Hide resolved
logging/logging.go Outdated Show resolved Hide resolved
@codyoss codyoss changed the title fix(logging): do not panic in library code (#1862) fix(logging): do not panic in library code Oct 23, 2020
@0xSage 0xSage requested a review from codyoss Oct 23, 2020
logging/logging.go Outdated Show resolved Hide resolved
@0xSage 0xSage marked this pull request as draft Oct 27, 2020
Copy link
Contributor Author

@0xSage 0xSage left a comment

After careful consideration:

  1. When r.Request is nil, we pipe error message to errc like @tbpg suggested!

  2. When protoStruct contains non-parseable but VALID JSON, we don't log to user at all because i) they will already know a property didn't parse correctly (see a nil value) ii) It's not a user error and there's nothing the user can do to solve this issue. So we don't log per client library convention to be less verbose.

"libraries shouldn't log" :)

logging/logging.go Outdated Show resolved Hide resolved
@0xSage 0xSage marked this pull request as ready for review Oct 28, 2020
@0xSage 0xSage requested a review from tbpg Oct 28, 2020
logging/logging.go Show resolved Hide resolved
@0xSage 0xSage requested a review from as a code owner Oct 29, 2020
tbpg
tbpg approved these changes Oct 29, 2020
@0xSage
Copy link
Contributor Author

@0xSage 0xSage commented Oct 29, 2020

@codyoss ready for your review on previous change requested, thanks!

Copy link
Member

@codyoss codyoss left a comment

LGTM

@gcf-merge-on-green gcf-merge-on-green bot merged commit 529be97 into master Oct 29, 2020
3 checks passed
@gcf-merge-on-green gcf-merge-on-green bot deleted the fix1862 branch Oct 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants