Skip to content

Commit

Permalink
Handle exception when user supplied path for asdf was not found
Browse files Browse the repository at this point in the history
Co-authored-by: Vinicius Stock <[email protected]>
  • Loading branch information
srcid and vinistock authored Oct 17, 2024
1 parent f2564f0 commit 9286573
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions vscode/src/ruby/asdf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,15 @@ export class Asdf extends VersionManager {
const asdfPath = config.get<string | undefined>("rubyVersionManager.asdfExecutablePath");

if (asdfPath) {
const possiblePath = vscode.Uri.joinPath(
vscode.Uri.parse(asdfPath),
scriptName,
);
const configuredPath = vscode.Uri.file(asdfPath);

try {
await vscode.workspace.fs.stat(possiblePath);
return possiblePath;
await vscode.workspace.fs.stat(configuredPath);
return configuredPath;
} catch (error: any) {
// Continue looking
throw new Error(
`ASDF executable configured as ${configuredPath}, but that file doesn't exist`,
);
}
}

Expand Down

0 comments on commit 9286573

Please sign in to comment.