* Initialize the task mode from the provider state. * This method handles async initialization with proper error handling. * * ## Flow * 1. Attempts to fetch the current mode from provider state * 2. Sets `_taskMode` to the fetched mode or `defaultModeSlug` if unavailable * 3. Handles er
(provider: ClineProvider)
| 633 | * @returns Promise that resolves when initialization is complete |
| 634 | */ |
| 635 | private async initializeTaskMode(provider: ClineProvider): Promise<void> { |
| 636 | try { |
| 637 | const state = await provider.getState() |
| 638 | this._taskMode = state?.mode || defaultModeSlug |
| 639 | } catch (error) { |
| 640 | // If there's an error getting state, use the default mode |
| 641 | this._taskMode = defaultModeSlug |
| 642 | // Use the provider's log method for better error visibility |
| 643 | const errorMessage = `Failed to initialize task mode: ${error instanceof Error ? error.message : String(error)}` |
| 644 | provider.log(errorMessage) |
| 645 | } |
| 646 | } |
| 647 | |
| 648 | /** |
| 649 | * Initialize the task API config name from the provider state. |
no test coverage detected