Improve error handling in DevChat dependency check

- Add a catch block to handle errors when checking pipx environment path.
- Log detailed error message when DevChat dependency check fails.
- Move DevChat installation check to a separate try-catch block.
- Update logger error message to info when pipx environment path is not found.
This commit is contained in:
bobo.yang 2023-06-16 09:05:10 +08:00
parent 9820571783
commit 1bb215f51b

View File

@ -13,13 +13,17 @@ export function checkDevChatDependency(pythonCommand: string): boolean {
} else {
logger.channel()?.info(`Failed to obtain the pipx environment path.`);
}
// Check if DevChat is installed
runCommand('devchat --help');
return true;
} catch (error) {
// DevChat dependency check failed
// log out detail error message
logger.channel()?.info(`Failed to check DevChat dependency due to error: ${error}`);
}
try {
// Check if DevChat is installed
runCommand('devchat --help');
return true;
} catch(error) {
logger.channel()?.error(`Failed to check DevChat dependency due to error: ${error}`);
return false;
}