Skip to content

Commit cd588d3

Browse files
authored
Improve FileSystemError by adding associated path (swiftlang#348)
Currently `FileSystemError` doesn't have an associated path, which makes diagnosing errors harder. This is going to be fixed in TSC and SwiftPM, but this is a breaking change. Usage of `FileSystemError` is updated in the SourceKit-LSP codebase accordingly.
1 parent 892579c commit cd588d3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Sources/SKCore/XCToolchainPlist.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,17 @@ extension XCToolchainPlist {
4646
RelativePath("Info.plist"), // Swift.org
4747
]
4848

49+
var missingPlistPath: AbsolutePath?
4950
for plistPath in plistNames.lazy.map({ path.appending($0) }) {
5051
if fileSystem.isFile(plistPath) {
5152
try self.init(path: plistPath, fileSystem)
5253
return
5354
}
55+
56+
missingPlistPath = plistPath
5457
}
5558

56-
throw FileSystemError.noEntry
59+
throw FileSystemError(.noEntry, missingPlistPath)
5760
#else
5861
throw Error.unsupportedPlatform
5962
#endif

0 commit comments

Comments
 (0)