( componentInfo: ReactComponentInfo, trackIdx: number, startTime: number, endTime: number, childrenEndTime: number, rootEnv: string, error: mixed, )
| 192 | } |
| 193 | |
| 194 | export 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 | |
| 251 | export function logDedupedComponentRender( |
no test coverage detected