Skip to content

Commit 3158d58

Browse files
authored
Prevent manifest load errors from causing SwiftPM to display "fatalError" in CLI (#3262)
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 0daea76 commit 3158d58

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
@@ -1424,7 +1424,13 @@ extension Workspace {
14241424

14251425
switch result {
14261426
case .failure(let error):
1427-
diagnostics.emit(error)
1427+
// Diagnostics.fatalError indicates that a more specific diagnostic has already been added.
1428+
switch error {
1429+
case Diagnostics.fatalError:
1430+
break
1431+
default:
1432+
diagnostics.emit(error)
1433+
}
14281434
case .success(let manifest):
14291435
self.delegate?.didLoadManifest(packagePath: packagePath, url: packageLocation, version: version, packageKind: packageKind, manifest: manifest, diagnostics: manifestDiagnostics.diagnostics)
14301436
}

0 commit comments

Comments
 (0)