MCPcopy Index your code
hub / github.com/reactjs/react-rails / printWarning

Function printWarning

lib/assets/react-source/development/react.js:683–720  ·  view source on GitHub ↗
(level, format, args)

Source from the content-addressed store, hash-verified

681 }
682
683 function printWarning(level, format, args) {
684 // When changing this logic, you might want to also
685 // update consoleWithStackDev.www.js as well.
686 {
687 var hasExistingStack = args.length > 0 && typeof args[args.length - 1] === 'string' && args[args.length - 1].indexOf('\n in') === 0;
688
689 if (!hasExistingStack) {
690 var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
691 var stack = ReactDebugCurrentFrame.getStackAddendum();
692
693 if (stack !== '') {
694 format += '%s';
695 args = args.concat([stack]);
696 }
697 }
698
699 var argsWithFormat = args.map(function (item) {
700 return '' + item;
701 }); // Careful: RN currently depends on this prefix
702
703 argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
704 // breaks IE9: https://github.com/facebook/react/issues/13610
705 // eslint-disable-next-line react-internal/no-production-logging
706
707 Function.prototype.apply.call(console[level], console, argsWithFormat);
708
709 try {
710 // --- Welcome to debugging React ---
711 // This error was thrown as a convenience so that you can use this stack
712 // to find the callsite that caused this warning to fire.
713 var argIndex = 0;
714 var message = 'Warning: ' + format.replace(/%s/g, function () {
715 return args[argIndex++];
716 });
717 throw new Error(message);
718 } catch (x) {}
719 }
720 }
721
722 var didWarnStateUpdateForUnmountedComponent = {};
723

Callers 6

warnFunction · 0.70
errorFunction · 0.70
checkPropTypesFunction · 0.70
checkTypeFunction · 0.70
createEnumTypeCheckerFunction · 0.70
createUnionTypeCheckerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected