Skip to content

Commit f876c5a

Browse files
Fix final layer of error handling in command plugin (#795)
1 parent 37bff7a commit f876c5a

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Plugins/OpenAPIGeneratorCommand/plugin.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,11 @@ extension SwiftOpenAPIGeneratorPlugin: CommandPlugin {
8282
hadASuccessfulRun = true
8383
} catch let error as PluginError {
8484
if error.isMisconfigurationError {
85-
print("- OpenAPI code generation failed with error.")
85+
print("- Stopping because target isn't configured for OpenAPI code generation.")
8686
throw error
8787
} else {
88-
print("- Stopping because target isn't configured for OpenAPI code generation.")
88+
print("- OpenAPI code generation failed with error.")
89+
throw error
8990
}
9091
}
9192
}

Sources/swift-openapi-generator/GenerateOptions+runGenerator.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ extension _GenerateOptions {
5252
}
5353
let (diagnostics, finalizeDiagnostics) = preparedDiagnosticsCollector(outputPath: diagnosticsOutputPath)
5454
let doc = self.docPath
55-
print(
55+
FileHandle.standardError.write(
5656
"""
5757
Swift OpenAPI Generator is running with the following configuration:
5858
- OpenAPI document path: \(doc.path)

0 commit comments

Comments
 (0)