Skip to content

Commit ef60eee

Browse files
Keito Uchiyamazpao
authored andcommitted
Make transferPropsTo() message easier to debug
Summary: Made the transferPropsTo() error introduced in 3253228 easier to use to debug.
1 parent 7a9c13d commit ef60eee

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/core/ReactPropTransferer.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,11 @@ var ReactPropTransferer = {
9393
transferPropsTo: function(component) {
9494
invariant(
9595
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
99101
);
100102

101103
var props = {};

src/core/__tests__/ReactPropTransferer-test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ describe('ReactPropTransferer', function() {
148148
ReactTestUtils.renderIntoDocument(<Parent />);
149149
}).toThrow(
150150
'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. ' +
152153
'This usually means you are calling transferPropsTo() on a component ' +
153154
'passed in as props or children.'
154155
);

0 commit comments

Comments
 (0)