( ioInfo: ReactIOInfo, rootEnv: string, error: mixed, )
| 528 | } |
| 529 | |
| 530 | export function logIOInfoErrored( |
| 531 | ioInfo: ReactIOInfo, |
| 532 | rootEnv: string, |
| 533 | error: mixed, |
| 534 | ): void { |
| 535 | const startTime = ioInfo.start; |
| 536 | const endTime = ioInfo.end; |
| 537 | if (supportsUserTiming && endTime >= 0) { |
| 538 | const description = getIODescription(error); |
| 539 | const entryName = getIOShortName(ioInfo, description, ioInfo.env, rootEnv); |
| 540 | const debugTask = ioInfo.debugTask; |
| 541 | if (__DEV__ && debugTask) { |
| 542 | const message = |
| 543 | typeof error === 'object' && |
| 544 | error !== null && |
| 545 | typeof error.message === 'string' |
| 546 | ? // eslint-disable-next-line react-internal/safe-string-coercion |
| 547 | String(error.message) |
| 548 | : // eslint-disable-next-line react-internal/safe-string-coercion |
| 549 | String(error); |
| 550 | const properties = [['rejected with', message]]; |
| 551 | const tooltipText = |
| 552 | getIOLongName(ioInfo, description, ioInfo.env, rootEnv) + ' Rejected'; |
| 553 | debugTask.run( |
| 554 | // $FlowFixMe[method-unbinding] |
| 555 | performance.measure.bind(performance, '\u200b' + entryName, { |
| 556 | start: startTime < 0 ? 0 : startTime, |
| 557 | end: endTime, |
| 558 | detail: { |
| 559 | devtools: { |
| 560 | color: 'error', |
| 561 | track: IO_TRACK, |
| 562 | properties, |
| 563 | tooltipText, |
| 564 | }, |
| 565 | }, |
| 566 | }), |
| 567 | ); |
| 568 | } else { |
| 569 | console.timeStamp( |
| 570 | entryName, |
| 571 | startTime < 0 ? 0 : startTime, |
| 572 | endTime, |
| 573 | IO_TRACK, |
| 574 | undefined, |
| 575 | 'error', |
| 576 | ); |
| 577 | } |
| 578 | } |
| 579 | } |
| 580 | |
| 581 | export function logIOInfo( |
| 582 | ioInfo: ReactIOInfo, |
no test coverage detected