已合并
[bugfix][ide-plugins] #46 异常提示信息修正 #76
Qunka创建于 11 天前
[bugfix][ide-plugins] #46 异常提示信息修正 #76
已合并
共 8 个文件变更+60-44
| @@ -179,7 +179,9 @@ const cjmpBuildWithSpawn = async ( | |||
| 179 | resolve(); | 179 | resolve(); |
| 180 | 180 | ||
| 181 | } catch (error) { | 181 | } catch (error) { |
| 182 | - vscode.window.showErrorMessage(`Error building ${type}. : ${error instanceof Error ? error.message : String(error)}`); | 182 | + vscode.window.showErrorMessage( |
| 183 | + `Failed to build ${type}: ${error instanceof Error ? error.message : String(error)}`, | ||
| 184 | + ); | ||
| 183 | reject(error); | 185 | reject(error); |
| 184 | } | 186 | } |
| 185 | }); | 187 | }); |
| @@ -532,7 +532,7 @@ export function getAdbPath(): string { | |||
| 532 | return pathResult.trim(); | 532 | return pathResult.trim(); |
| 533 | } | 533 | } |
| 534 | } catch { | 534 | } catch { |
| 535 | - vscode.window.showErrorMessage('Failed to find the environment variable for adb'); | 535 | + // Continue with ANDROID_SDK_ROOT before reporting that adb is unavailable. |
| 536 | } | 536 | } |
| 537 | const sdkRoot = process.env.ANDROID_SDK_ROOT; | 537 | const sdkRoot = process.env.ANDROID_SDK_ROOT; |
| 538 | if (sdkRoot) { | 538 | if (sdkRoot) { |
| @@ -542,9 +542,7 @@ export function getAdbPath(): string { | |||
| 542 | } | 542 | } |
| 543 | } | 543 | } |
| 544 | vscode.window.showErrorMessage( | 544 | vscode.window.showErrorMessage( |
| 545 | - `Could not find ${adbExe} executable. Please try either:\n` + | 545 | + `Could not find ${adbExe}. Add adb to PATH or set ANDROID_SDK_ROOT to your Android SDK directory.`, |
| 546 | - `1. Add adb to the system PATH environment variable.\n` + | ||
| 547 | - `2. Set ANDROID_SDK_ROOT environment variable to your SDK root directory.`, | ||
| 548 | ); | 546 | ); |
| 549 | return ''; | 547 | return ''; |
| 550 | } | 548 | } |
| @@ -685,7 +683,7 @@ export function getDevecoCangjiePath(): string | undefined { | |||
| 685 | const devecoCangjiePath = process.env.DEVECO_CANGJIE_PATH; | 683 | const devecoCangjiePath = process.env.DEVECO_CANGJIE_PATH; |
| 686 | if (!devecoCangjiePath || !fs.existsSync(devecoCangjiePath)) { | 684 | if (!devecoCangjiePath || !fs.existsSync(devecoCangjiePath)) { |
| 687 | vscode.window.showErrorMessage( | 685 | vscode.window.showErrorMessage( |
| 688 | - "DEVECO_CANGJIE_PATH is not set or the path does not exist. Please configure it and restart VS Code." | 686 | + 'DEVECO_CANGJIE_PATH is not set or points to a non-existent path. Configure it and restart VS Code.', |
| 689 | ); | 687 | ); |
| 690 | return undefined; | 688 | return undefined; |
| 691 | } | 689 | } |