Skip to content

CPLAT-6376 Add helpful error message when @Component() is used with UiComponent2#320

Merged
rmconsole6-wk merged 5 commits into3.1.0-wipfrom
CPLAT-6376-add-helpful-error-message
Jul 19, 2019
Merged

CPLAT-6376 Add helpful error message when @Component() is used with UiComponent2#320
rmconsole6-wk merged 5 commits into3.1.0-wipfrom
CPLAT-6376-add-helpful-error-message

Conversation

@sydneyjodon-wk
Copy link
Contributor

@sydneyjodon-wk sydneyjodon-wk commented Jul 17, 2019

Motivation

Right now, accidentally using @Component() instead of @Component2() gives you an unhelpful error message.

require.js:143 Uncaught Error: UngeneratedError: `Symbol("typedPropsFactoryJs")` should be implemented by code generation.

Ensure that you're running a build via build_runner.
    at Object.dart.throw (dart_sdk.js:4604)
    at basic_with_state._$BasicComponent.new.typedPropsFactoryJs (component_base.ddc.js:550)
    at basic_with_state._$BasicComponent.new.newProps (component_base.ddc.js:388)
    at basic_with_state._$BasicComponent.new.getDefaultProps (abstract_inheritance.ddc.js:1973)
    at Object.react_client._registerComponent2 (react.ddc.js:864)
    at react_client._registerComponent (react.ddc.js:849)
    at Object.dart._checkAndCall (dart_sdk.js:4807)
    at Object.dart.dcall (dart_sdk.js:4812)
    at Object.src__component_declaration__component_base.registerComponent (component_base.ddc.js:3041)
    at get $BasicComponentFactory (abstract_inheritance.ddc.js:2132)
    at Object.desc.get [as $BasicComponentFactory] (dart_sdk.js:3639)
    at basic_with_state._$$BasicProps.new.get componentFactory [as componentFactory] (abstract_inheritance.ddc.js:2041)
    at basic_with_state._$$BasicProps.new.call (component_base.ddc.js:2746)
    at Object.index.main (abstract_inheritance.ddc.js:2632)

We need to provide a runtime error with a helpful message when this occurs.

Changes

  • Add better messages to existing UngeneratedErrors for members that were added in UiComponent2.
    • typedPropsFactoryJs
    • UiComponent2 props getter
    • UiStatefulComponent2 state getter
  • Write an integration test to check that a helpful error message is thrown when rendering a UiComponent2 with a @Component() annotation.

Release Notes

Review

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

Please review:
@kealjones-wk @aaronlademann-wf @greglittlefield-wf @joebingham-wk

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

@aviary3-wk
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.

Copy link
Contributor

@joebingham-wk joebingham-wk left a comment

Choose a reason for hiding this comment

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

This looks great to me - I didn't catch anything I'd do differently!

+1

@greglittlefield-wf
Copy link
Contributor

+10

Nice job @sydneyjodon-wk!

@Workiva/release-management-p

@rmconsole6-wk rmconsole6-wk merged commit 4bbe644 into 3.1.0-wip Jul 19, 2019
@rmconsole6-wk rmconsole6-wk deleted the CPLAT-6376-add-helpful-error-message branch July 19, 2019 17:46
@aaronlademann-wf aaronlademann-wf added this to the 3.1.0 milestone Aug 6, 2019
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.

7 participants