-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enforce error diagnostics by aborting execution #607
Enforce error diagnostics by aborting execution #607
Conversation
I have a question because I'm a bit confused about what to do after the creation of the wrapper. Should we use the wrapper in place of the extensions from DiagnosticCollector? |
I think struct ErrorThrowingDiagnosticCollector: DiagnosticCollector {
var upstream: any DiagnosticCollector
func emit(_ diagnostic: Diagnostic) throws {
upstream.emit(diagnostic)
if diagnostic.severity == .error { throw diagnostic }
}
} And then use this collector by default, wrapping today's collector. |
It makes sense, perfect!! |
Sources/swift-openapi-generator/GenerateOptions+runGenerator.swift
Outdated
Show resolved
Hide resolved
@swift-server-bot test this please |
Ok the code looks good, would you be able to add one test that constructs the pipeline with a malformed input and ends up throwing the error? Just to verify that it's really working? |
Sure. |
@swift-server-bot test this please |
Got some build failures on Linux:
You can fix the first one by using |
@swift-server-bot test this please |
You'll need to add the file to the license check ignore list. |
Hmm this actually breaks 5.9.0, because it creates a dependency of a test target on an executable target. https://ci.swiftserver.group/job/swift-openapi-generator-swift590-prb/246/console To fix this, you'll need to start depending on I don't think we'll be able to make the new dependency work otherwise. |
Sources/swift-openapi-generator/GenerateOptions+runGenerator.swift
Outdated
Show resolved
Hide resolved
@swift-server-bot test this please |
@swift-server-bot test this please |
@swift-server-bot test this please |
@PARAIPAN9 The CI is happy, but I believe we still need to move the remaining diagnostic collection code into the new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @PARAIPAN9, looks great now!
Motivation
Modifications
ErrorThrowingDiagnosticCollector
wrapper collector.Result
ErrorThrowingDiagnosticCollector
throws an error when a diagnostic with severity.error
is emited.Test Plan