MCPcopy Index your code
hub / github.com/react/react / logComponentErrored

Function logComponentErrored

packages/react-client/src/ReactFlightPerformanceTrack.js:194–249  ·  view source on GitHub ↗
(
  componentInfo: ReactComponentInfo,
  trackIdx: number,
  startTime: number,
  endTime: number,
  childrenEndTime: number,
  rootEnv: string,
  error: mixed,
)

Source from the content-addressed store, hash-verified

192}
193
194export function logComponentErrored(
195 componentInfo: ReactComponentInfo,
196 trackIdx: number,
197 startTime: number,
198 endTime: number,
199 childrenEndTime: number,
200 rootEnv: string,
201 error: mixed,
202): void {
203 if (supportsUserTiming) {
204 const env = componentInfo.env;
205 const name = componentInfo.name;
206 const isPrimaryEnv = env === rootEnv;
207 const entryName =
208 isPrimaryEnv || env === undefined ? name : name + ' [' + env + ']';
209 if (__DEV__) {
210 const message =
211 typeof error === 'object' &&
212 error !== null &&
213 typeof error.message === 'string'
214 ? // eslint-disable-next-line react-internal/safe-string-coercion
215 String(error.message)
216 : // eslint-disable-next-line react-internal/safe-string-coercion
217 String(error);
218 const properties: Array<[string, string]> = [['Error', message]];
219 if (componentInfo.key != null) {
220 addValueToProperties('key', componentInfo.key, properties, 0, '');
221 }
222 if (componentInfo.props != null) {
223 addObjectToProperties(componentInfo.props, properties, 0, '');
224 }
225 performance.measure('\u200b' + entryName, {
226 start: startTime < 0 ? 0 : startTime,
227 end: childrenEndTime,
228 detail: {
229 devtools: {
230 color: 'error',
231 track: trackNames[trackIdx],
232 trackGroup: COMPONENTS_TRACK,
233 tooltipText: entryName + ' Errored',
234 properties,
235 },
236 },
237 });
238 } else {
239 console.timeStamp(
240 entryName,
241 startTime < 0 ? 0 : startTime,
242 childrenEndTime,
243 trackNames[trackIdx],
244 COMPONENTS_TRACK,
245 'error',
246 );
247 }
248 }
249}
250
251export function logDedupedComponentRender(

Callers 1

Calls 3

addValueToPropertiesFunction · 0.90
addObjectToPropertiesFunction · 0.90
measureMethod · 0.65

Tested by

no test coverage detected