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

CPLAT-7721 Add error logging to ErrorBoundary #370

Merged
merged 5 commits into from
Oct 16, 2019

Conversation

aaronlademann-wf
Copy link
Contributor

@aaronlademann-wf aaronlademann-wf commented Oct 15, 2019

Motivation

Consumers currently have to set their own onComponentDidCatch prop callback, and then manually pass the errors passed to that callback into their own instance of Logger.

Changes

  • Add logging functionality to ErrorBoundary so that consumers get it for free, and they can simply set props.loggerName to customize the logger name if they choose.
  • Consumers can then simply listen to the ErrorBoundaryComponent.logger if they want to log it to the service of their choice.

Release Notes

Add logging functionality to the ErrorBoundary

Review

See CONTRIBUTING.md for more details on review types (+1 / QA +1 / +10) and code review process.

Please review: @greglittlefield-wf @kealjones-wk @joebingham-wk @sydneyjodon-wk @maxwellpeterson-wf

QA Checklist

  • Tests were updated and provide good coverage of the changeset and other affected code
  • Manual testing was performed if needed

Merge Checklist

While we perform many automated checks before auto-merging, some manual checks are needed:

  • A Client Platform member has reviewed these changes
  • There are no unaddressed comments - this check can be automated if reviewers use the "Request Changes" feature
  • For release PRs - Version metadata in Rosie comment is correct

@aaronlademann-wf aaronlademann-wf added this to the 3.0.0 milestone Oct 15, 2019
@aviary2-wf
Copy link

Security Insights

No security relevant content was detected by automated scans.

Action Items

  • Review PR for security impact; comment "security review required" if needed or unsure
  • Verify aviary.yaml coverage of security relevant code

Questions or Comments? Reach out on Slack: #support-infosec.

@aaronlademann-wf aaronlademann-wf force-pushed the 3.0.0/error-boundary-logging+dart2 branch from 96714f3 to be378d7 Compare October 15, 2019 19:15
Copy link
Contributor

@greglittlefield-wf greglittlefield-wf left a comment

Choose a reason for hiding this comment

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

Looking good, some comments/questions

lib/src/component/error_boundary.dart Outdated Show resolved Hide resolved
lib/src/component/error_boundary.dart Outdated Show resolved Hide resolved
lib/src/component/error_boundary.dart Outdated Show resolved Hide resolved
lib/src/component/error_boundary.dart Outdated Show resolved Hide resolved
lib/src/component/error_boundary.dart Show resolved Hide resolved
Logger get logger => _logger;
Logger _logger;
/// The value that will be used when creating a [Logger] to log errors from this component.
String get loggerName {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a use-case for making this public? Consumers know which logger/loggerName they passed in; we shouldn't need to expose that info via an API method.

Logger _logger;
/// The value that will be used when creating a [Logger] to log errors from this component.
String get loggerName {
if (props.logger != null) return props.logger.name;
Copy link
Contributor

Choose a reason for hiding this comment

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

Related to the above comment; if this isn't public, this won't be necessary.

test/over_react/component/error_boundary_test.dart Outdated Show resolved Hide resolved
test/over_react/component/error_boundary_test.dart Outdated Show resolved Hide resolved
Copy link
Contributor

@greglittlefield-wf greglittlefield-wf left a comment

Choose a reason for hiding this comment

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

+1

@greglittlefield-wf
Copy link
Contributor

QA +1

@Workiva/release-management-p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants