@@ -66,9 +66,7 @@ extension SwiftPackageCommand {
6666
6767 public func run( _ swiftCommandState: SwiftCommandState ) async throws {
6868 // First, validate and resolve the requested feature names.
69- guard let features = try self . resolveRequestedFeatures ( swiftCommandState) else {
70- return
71- }
69+ let features = try self . resolveRequestedFeatures ( swiftCommandState)
7270
7371 let buildSystem = try await createBuildSystem (
7472 swiftCommandState,
@@ -173,11 +171,10 @@ extension SwiftPackageCommand {
173171
174172 /// Resolves the requested feature names.
175173 ///
176- /// - Returns: An array of resolved features sorted by name, or `nil`
177- /// if an error was emitted.
174+ /// - Returns: An array of resolved features, sorted by name.
178175 private func resolveRequestedFeatures(
179176 _ swiftCommandState: SwiftCommandState
180- ) throws -> [ SwiftCompilerFeature ] ? {
177+ ) throws -> [ SwiftCompilerFeature ] {
181178 let toolchain = try swiftCommandState. productsBuildParameters. toolchain
182179
183180 // Query the compiler for supported features.
@@ -197,15 +194,13 @@ extension SwiftPackageCommand {
197194 . sorted ( )
198195 . joined ( separator: " , " )
199196
200- swiftCommandState . observabilityScope . emit (
201- error : " Unsupported feature ' \( name) '. Available features: \( migratableCommaSeparatedFeatures) "
197+ throw ValidationError (
198+ " Unsupported feature ' \( name) '. Available features: \( migratableCommaSeparatedFeatures) "
202199 )
203- return nil
204200 }
205201
206202 guard feature. migratable else {
207- swiftCommandState. observabilityScope. emit ( error: " Feature ' \( name) ' is not migratable " )
208- return nil
203+ throw ValidationError ( " Feature ' \( name) ' is not migratable " )
209204 }
210205
211206 resolvedFeatures. append ( feature)
0 commit comments