Skip to content

Commit cdaf7cf

Browse files
committed
Add clearer error message when loading packages in swift-bootstrap
Remove the fatalErrors now that root cause has been established
1 parent 5bbda5a commit cdaf7cf

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

Sources/Basics/FileSystem/AbsolutePath.swift

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ public struct AbsolutePath: Hashable, Sendable {
5353
/// The input string will be normalized if needed, as described in the
5454
/// documentation for AbsolutePath.
5555
public init(validating pathString: String) throws {
56-
// FIXME: remove once the error has been traced
57-
if pathString == "https://github.com/apple/swift-asn1.git" {
58-
fatalError("ERROR1")
59-
}
6056
self.underlying = try .init(validating: pathString)
6157
}
6258

@@ -287,14 +283,7 @@ extension AbsolutePath: Codable {
287283
}
288284

289285
public init(from decoder: Decoder) throws {
290-
do {
291-
try self = .init(TSCAbsolutePath(from: decoder))
292-
} catch {
293-
if "\(error)".contains("https://github.com/apple/swift-asn1.git") {
294-
fatalError("ERROR2")
295-
}
296-
throw error
297-
}
286+
try self = .init(TSCAbsolutePath(from: decoder))
298287
}
299288
}
300289

Sources/swift-bootstrap/main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ struct SwiftBootstrapBuildTool: AsyncParsableCommand {
443443
manifestLoader: ManifestLoader,
444444
package: PackageReference
445445
) async throws -> Manifest {
446-
let packagePath = try AbsolutePath(validating: package.locationString) // FIXME
446+
let packagePath = try Result { try AbsolutePath(validating: package.locationString) }.mapError({ StringError("Package path \(package.locationString) is not an absolute path. This can be caused by a dependency declared somewhere in the package graph that is using a URL instead of a local path. Original error: \($0)") }).get()
447447
let manifestPath = packagePath.appending(component: Manifest.filename)
448448
let manifestToolsVersion = try ToolsVersionParser.parse(manifestPath: manifestPath, fileSystem: fileSystem)
449449
return try await manifestLoader.load(

0 commit comments

Comments
 (0)