* Safely invoke a progress callback, catching and logging any errors. * Prevents callback errors from aborting marketplace operations. * * @param onProgress - The progress callback to invoke * @param message - Progress message to pass to the callback
( onProgress: MarketplaceProgressCallback | undefined, message: string, )
| 1005 | * @param message - Progress message to pass to the callback |
| 1006 | */ |
| 1007 | function safeCallProgress( |
| 1008 | onProgress: MarketplaceProgressCallback | undefined, |
| 1009 | message: string, |
| 1010 | ): void { |
| 1011 | if (!onProgress) return |
| 1012 | try { |
| 1013 | onProgress(message) |
| 1014 | } catch (callbackError) { |
| 1015 | logForDebugging(`Progress callback error: ${errorMessage(callbackError)}`, { |
| 1016 | level: 'warn', |
| 1017 | }) |
| 1018 | } |
| 1019 | } |
| 1020 | |
| 1021 | /** |
| 1022 | * Reconcile the on-disk sparse-checkout state with the desired config. |
no test coverage detected