Skip to content

Commit

Permalink
Make transferPropsTo() message easier to debug
Browse files Browse the repository at this point in the history
Summary:
Made the transferPropsTo() error introduced in
3253228 easier to use to debug.
  • Loading branch information
keito authored and zpao committed Oct 9, 2013
1 parent 7a9c13d commit ef60eee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/core/ReactPropTransferer.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,11 @@ var ReactPropTransferer = {
transferPropsTo: function(component) {
invariant(
component.props.__owner__ === this,
'You can\'t call transferPropsTo() on a component that you don\'t ' +
'own. This usually means you are calling transferPropsTo() on a ' +
'component passed in as props or children.'
'%s: You can\'t call transferPropsTo() on a component that you ' +
'don\'t own, %s. This usually means you are calling ' +
'transferPropsTo() on a component passed in as props or children.',
this.constructor.displayName,
component.constructor.displayName
);

var props = {};
Expand Down
3 changes: 2 additions & 1 deletion src/core/__tests__/ReactPropTransferer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ describe('ReactPropTransferer', function() {
ReactTestUtils.renderIntoDocument(<Parent />);
}).toThrow(
'Invariant Violation: ' +
'You can\'t call transferPropsTo() on a component that you don\'t own. ' +
'Child: You can\'t call transferPropsTo() on a component that you ' +
'don\'t own, span. ' +
'This usually means you are calling transferPropsTo() on a component ' +
'passed in as props or children.'
);
Expand Down

0 comments on commit ef60eee

Please sign in to comment.