( phase: string, step: string, run: () => Promise<T> )
| 29 | }); |
| 30 | |
| 31 | async function traceStartupStep<T>( |
| 32 | phase: string, |
| 33 | step: string, |
| 34 | run: () => Promise<T> |
| 35 | ): Promise<T> { |
| 36 | const startedAt = nowMs(); |
| 37 | startupTrace.markPhase(`${phase}_start`, { step }); |
| 38 | try { |
| 39 | const value = await run(); |
| 40 | startupTrace.markPhase(`${phase}_end`, { |
| 41 | step, |
| 42 | durationMs: elapsedMs(startedAt), |
| 43 | }); |
| 44 | return value; |
| 45 | } catch (error) { |
| 46 | startupTrace.markPhase(`${phase}_failed`, { |
| 47 | step, |
| 48 | durationMs: elapsedMs(startedAt), |
| 49 | }); |
| 50 | throw error; |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | /** Dedupe only for white-screen heuristic (empty #root), not for Error Boundary logs. */ |
| 55 | const WHITE_SCREEN_LOGGED_FLAG = '__bitfun_white_screen_crash_logged__'; |
no test coverage detected