()
| 509 | } |
| 510 | |
| 511 | public cleanup(): void { |
| 512 | try { |
| 513 | if (this.syncCleanupFn) { |
| 514 | this.syncCleanupFn() |
| 515 | this.syncCleanupFn = null |
| 516 | } |
| 517 | } catch (error) { |
| 518 | // Re-throw in a microtask to surface the error after cleanup completes |
| 519 | queueMicrotask(() => { |
| 520 | if (error instanceof Error) { |
| 521 | // Preserve the original error and stack trace |
| 522 | const wrappedError = new SyncCleanupError(this.id, error) |
| 523 | wrappedError.cause = error |
| 524 | wrappedError.stack = error.stack |
| 525 | throw wrappedError |
| 526 | } else { |
| 527 | throw new SyncCleanupError(this.id, error as Error | string) |
| 528 | } |
| 529 | }) |
| 530 | } |
| 531 | this.preloadPromise = null |
| 532 | } |
| 533 | } |
| 534 | |
| 535 | function normalizeSyncFnResult(result: void | CleanupFn | SyncConfigRes) { |
nothing calls this directly
no outgoing calls
no test coverage detected