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
+
1
15
import * as path from "node:path" ;
2
16
import { SwiftlyConfig } from "./ToolchainVersion" ;
3
17
import * as fs from "node:fs/promises" ;
@@ -71,7 +85,7 @@ export class Swiftly {
71
85
const response = ListAvailableResult . parse ( JSON . parse ( stdout ) ) ;
72
86
return response . toolchains . map ( t => t . name ) ;
73
87
} 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} " ) ;
75
89
}
76
90
}
77
91
@@ -93,7 +107,7 @@ export class Swiftly {
93
107
. filter ( ( toolchain ) : toolchain is string => typeof toolchain === "string" )
94
108
. map ( toolchain => path . join ( swiftlyHomeDir , "toolchains" , toolchain ) ) ;
95
109
} 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} " ) ;
97
111
}
98
112
}
99
113
@@ -129,7 +143,7 @@ export class Swiftly {
129
143
} catch ( err : unknown ) {
130
144
const error = err as ExecFileError ;
131
145
// 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 } ` ) ;
133
147
}
134
148
}
135
149
}
0 commit comments