MCPcopy Create free account
hub / github.com/reactjs/react-rails / logError

Function logError

lib/assets/react-source/development/react.js:23233–23269  ·  view source on GitHub ↗
(boundary, errorInfo)

Source from the content-addressed store, hash-verified

23231
23232 var PossiblyWeakSet = typeof WeakSet === 'function' ? WeakSet : Set;
23233 function logError(boundary, errorInfo) {
23234 var source = errorInfo.source;
23235 var stack = errorInfo.stack;
23236
23237 if (stack === null && source !== null) {
23238 stack = getStackByFiberInDevAndProd(source);
23239 }
23240
23241 var capturedError = {
23242 componentName: source !== null ? getComponentName(source.type) : null,
23243 componentStack: stack !== null ? stack : '',
23244 error: errorInfo.value,
23245 errorBoundary: null,
23246 errorBoundaryName: null,
23247 errorBoundaryFound: false,
23248 willRetry: false
23249 };
23250
23251 if (boundary !== null && boundary.tag === ClassComponent) {
23252 capturedError.errorBoundary = boundary.stateNode;
23253 capturedError.errorBoundaryName = getComponentName(boundary.type);
23254 capturedError.errorBoundaryFound = true;
23255 capturedError.willRetry = true;
23256 }
23257
23258 try {
23259 logCapturedError(capturedError);
23260 } catch (e) {
23261 // This method must not throw, or React internal state will get messed up.
23262 // If console.error is overridden, or logCapturedError() shows a dialog that throws,
23263 // we want to report this error outside of the normal stack as a last resort.
23264 // https://github.com/facebook/react/issues/13188
23265 setTimeout(function () {
23266 throw e;
23267 });
23268 }
23269 }
23270
23271 var callComponentWillUnmountWithTimer = function (current, instance) {
23272 startPhaseTimer(current, 'componentWillUnmount');

Callers 2

createRootErrorUpdateFunction · 0.85
createClassErrorUpdateFunction · 0.85

Calls 4

logCapturedErrorFunction · 0.85
setTimeoutFunction · 0.85
getComponentNameFunction · 0.70

Tested by

no test coverage detected