reportGlobalError() — react Function Reference
Architecture documentation for the reportGlobalError() function in reportGlobalError.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD cc7b0227_d75a_a3bb_8be8_7ebb47ae444b["reportGlobalError()"] 907ca3a8_162d_2f7c_679e_13bef30ef634["reportGlobalError.js"] cc7b0227_d75a_a3bb_8be8_7ebb47ae444b -->|defined in| 907ca3a8_162d_2f7c_679e_13bef30ef634 style cc7b0227_d75a_a3bb_8be8_7ebb47ae444b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/shared/reportGlobalError.js lines 15–49
: error => {
if (
typeof window === 'object' &&
typeof window.ErrorEvent === 'function'
) {
// Browser Polyfill
const message =
typeof error === 'object' &&
error !== null &&
typeof error.message === 'string'
? // eslint-disable-next-line react-internal/safe-string-coercion
String(error.message)
: // eslint-disable-next-line react-internal/safe-string-coercion
String(error);
const event = new window.ErrorEvent('error', {
bubbles: true,
cancelable: true,
message: message,
error: error,
});
const shouldLog = window.dispatchEvent(event);
if (!shouldLog) {
return;
}
} else if (
typeof process === 'object' &&
// $FlowFixMe[method-unbinding]
typeof process.emit === 'function'
) {
// Node Polyfill
process.emit('uncaughtException', error);
return;
}
console['error'](error);
};
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does reportGlobalError() do?
reportGlobalError() is a function in the react codebase, defined in packages/shared/reportGlobalError.js.
Where is reportGlobalError() defined?
reportGlobalError() is defined in packages/shared/reportGlobalError.js at line 15.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free