MCPcopy
hub / github.com/facebook/react / logRecoverableError

Function logRecoverableError

packages/react-server/src/ReactFizzServer.js:1218–1243  ·  view source on GitHub ↗
(
  request: Request,
  error: any,
  errorInfo: ThrownInfo,
  debugTask: null | ConsoleTask,
)

Source from the content-addressed store, hash-verified

1216}
1217
1218function logRecoverableError(
1219 request: Request,
1220 error: any,
1221 errorInfo: ThrownInfo,
1222 debugTask: null | ConsoleTask,
1223): ?string {
1224 // If this callback errors, we intentionally let that error bubble up to become a fatal error
1225 // so that someone fixes the error reporting instead of hiding it.
1226 const onError = request.onError;
1227 const errorDigest =
1228 __DEV__ && debugTask
1229 ? debugTask.run(onError.bind(null, error, errorInfo))
1230 : onError(error, errorInfo);
1231 if (errorDigest != null && typeof errorDigest !== 'string') {
1232 // We used to throw here but since this gets called from a variety of unprotected places it
1233 // seems better to just warn and discard the returned value.
1234 if (__DEV__) {
1235 console.error(
1236 'onError returned something with a type other than "string". onError should return a string and may return null or undefined but must not return anything else. It received something of type "%s" instead',
1237 typeof errorDigest,
1238 );
1239 }
1240 return;
1241 }
1242 return errorDigest;
1243}
1244
1245function fatalError(
1246 request: Request,

Callers 11

renderSuspenseBoundaryFunction · 0.70
replaySuspenseBoundaryFunction · 0.70
erroredReplayFunction · 0.70
erroredTaskFunction · 0.70
abortTaskFunction · 0.70
safelyEmitEarlyPreloadsFunction · 0.70
retryRenderTaskFunction · 0.70
performWorkFunction · 0.70
flushCompletedQueuesFunction · 0.70
startFlowingFunction · 0.70
abortFunction · 0.70

Calls 3

runMethod · 0.80
errorMethod · 0.65
onErrorFunction · 0.50

Tested by

no test coverage detected