Make transferPropsTo() message easier to debug
Summary: Made the transferPropsTo() error introduced in 325322898cc413454feede0201b61da1abe1e67e easier to use to debug.
Keito Uchiyama committed
Oct 9, 2013 at 11:11 UTC
ef60eee57ab8a86e47847761532cf72a1205b668
2 files changed
+7
-4
src/core/ReactPropTransferer.js
+5
-3
@@ -93,9 +93,11 @@ var ReactPropTransferer = {
93
transferPropsTo: function(component) {
94
invariant(
95
component.props.__owner__ === this,
96
- 'You can\'t call transferPropsTo() on a component that you don\'t ' +
97
- 'own. This usually means you are calling transferPropsTo() on a ' +
98
- 'component passed in as props or children.'
96
+ '%s: You can\'t call transferPropsTo() on a component that you ' +
97
+ 'don\'t own, %s. This usually means you are calling ' +
98
+ 'transferPropsTo() on a component passed in as props or children.',
99
+ this.constructor.displayName,
100
+ component.constructor.displayName
101
);
102
103
var props = {};
src/core/__tests__/ReactPropTransferer-test.js
+2
-1
@@ -148,7 +148,8 @@ describe('ReactPropTransferer', function() {
148
ReactTestUtils.renderIntoDocument(<Parent />);
149
}).toThrow(
150
'Invariant Violation: ' +
151
- 'You can\'t call transferPropsTo() on a component that you don\'t own. ' +
151
+ 'Child: You can\'t call transferPropsTo() on a component that you ' +
152
+ 'don\'t own, span. ' +
153
'This usually means you are calling transferPropsTo() on a component ' +
154
'passed in as props or children.'
155
);