@@ -66,9 +66,7 @@ extension SwiftPackageCommand {
66
66
67
67
public func run( _ swiftCommandState: SwiftCommandState ) async throws {
68
68
// 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)
72
70
73
71
let buildSystem = try await createBuildSystem (
74
72
swiftCommandState,
@@ -173,11 +171,10 @@ extension SwiftPackageCommand {
173
171
174
172
/// Resolves the requested feature names.
175
173
///
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.
178
175
private func resolveRequestedFeatures(
179
176
_ swiftCommandState: SwiftCommandState
180
- ) throws -> [ SwiftCompilerFeature ] ? {
177
+ ) throws -> [ SwiftCompilerFeature ] {
181
178
let toolchain = try swiftCommandState. productsBuildParameters. toolchain
182
179
183
180
// Query the compiler for supported features.
@@ -197,15 +194,13 @@ extension SwiftPackageCommand {
197
194
. sorted ( )
198
195
. joined ( separator: " , " )
199
196
200
- swiftCommandState . observabilityScope . emit (
201
- error : " Unsupported feature ' \( name) '. Available features: \( migratableCommaSeparatedFeatures) "
197
+ throw ValidationError (
198
+ " Unsupported feature ' \( name) '. Available features: \( migratableCommaSeparatedFeatures) "
202
199
)
203
- return nil
204
200
}
205
201
206
202
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 " )
209
204
}
210
205
211
206
resolvedFeatures. append ( feature)
0 commit comments