Skip to content

Commit 68bd6fd

Browse files
committed
[Workspace] Turn an IUO into a throwing error
There are reports of crashes in this area but it's not clear how would this ever happen since we shouldn't get here unless we know there is an available tag for the version. I've added some user visible logging so someone who runs into this can file a bug. <rdar://problem/55040410>
1 parent 11e94b1 commit 68bd6fd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Sources/Workspace/Workspace.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1949,7 +1949,9 @@ extension Workspace {
19491949
// annoying. Maybe we should make an SPI on the provider for
19501950
// this?
19511951
let container = try await { containerProvider.getContainer(for: package, skipUpdate: true, completion: $0) } as! RepositoryPackageContainer
1952-
let tag = container.getTag(for: version)!
1952+
guard let tag = container.getTag(for: version) else {
1953+
throw StringError("Internal error: please file a bug at https://bugs.swift.org with this info -- unable to get tag for \(package) \(version); available versions \(container.reversedVersions)")
1954+
}
19531955
let revision = try container.getRevision(forTag: tag)
19541956
checkoutState = CheckoutState(revision: revision, version: version)
19551957

0 commit comments

Comments
 (0)