Skip to content

Commit 5a07f8b

Browse files
committed
refactoring changes
1 parent c2bc8da commit 5a07f8b

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

src/toolchain/swiftly.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the VS Code Swift open source project
4+
//
5+
// Copyright (c) 2025 the VS Code Swift project authors
6+
// Licensed under Apache License v2.0
7+
//
8+
// See LICENSE.txt for license information
9+
// See CONTRIBUTORS.txt for the list of VS Code Swift project authors
10+
//
11+
// SPDX-License-Identifier: Apache-2.0
12+
//
13+
//===----------------------------------------------------------------------===//
14+
115
import * as path from "node:path";
216
import { SwiftlyConfig } from "./ToolchainVersion";
317
import * as fs from "node:fs/promises";
@@ -71,7 +85,7 @@ export class Swiftly {
7185
const response = ListAvailableResult.parse(JSON.parse(stdout));
7286
return response.toolchains.map(t => t.name);
7387
} catch (error) {
74-
throw new Error("Failed to retrieve Swiftly installations from disk.");
88+
throw new Error("Failed to retrieve Swiftly installations from disk: ${error.message}");
7589
}
7690
}
7791

@@ -93,7 +107,7 @@ export class Swiftly {
93107
.filter((toolchain): toolchain is string => typeof toolchain === "string")
94108
.map(toolchain => path.join(swiftlyHomeDir, "toolchains", toolchain));
95109
} catch (error) {
96-
throw new Error("Failed to retrieve Swiftly installations from disk.");
110+
throw new Error("Failed to retrieve Swiftly installations from disk: ${error.message}");
97111
}
98112
}
99113

@@ -129,7 +143,7 @@ export class Swiftly {
129143
} catch (err: unknown) {
130144
const error = err as ExecFileError;
131145
// Its possible the toolchain in .swift-version is misconfigured or doesn't exist.
132-
void vscode.window.showErrorMessage(`${error.stderr}`);
146+
void vscode.window.showErrorMessage(`Failed to load toolchain from Swiftly: ${error.stderr}`);
133147
}
134148
}
135149
}

0 commit comments

Comments
 (0)