mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Make transferPropsTo() message easier to debug
Summary:
Made the transferPropsTo() error introduced in
325322898c easier to use to debug.
This commit is contained in:
committed by
Paul O’Shannessy
parent
7a9c13dee8
commit
ef60eee57a
@@ -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 = {};
|
||||
|
||||
@@ -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.'
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user