Skip to content

Commit 70f81bb

Browse files
authored
Prevent manifest load errors from causing SwiftPM to display "fatalError" in CLI (#3261)
Looks like `Diagnostics.fatalError` is used to throw errors when appropriate diagnostics have already been emitted and the only goal is to quickly return to the caller. This is documented in TSCUtility. Future cleanup should avoid this special behavior. rdar://74263826
1 parent b23eb6d commit 70f81bb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Sources/Workspace/Workspace.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1486,7 +1486,13 @@ extension Workspace {
14861486

14871487
switch result {
14881488
case .failure(let error):
1489-
diagnostics.emit(error)
1489+
// Diagnostics.fatalError indicates that a more specific diagnostic has already been added.
1490+
switch error {
1491+
case Diagnostics.fatalError:
1492+
break
1493+
default:
1494+
diagnostics.emit(error)
1495+
}
14901496
case .success(let manifest):
14911497
self.delegate?.didLoadManifest(packagePath: packagePath, url: url, version: version, packageKind: packageKind, manifest: manifest, diagnostics: manifestDiagnostics.diagnostics)
14921498
}

0 commit comments

Comments
 (0)