File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed
Sources/SwiftJavaTool/Commands Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -86,10 +86,7 @@ extension SwiftJava.JExtractCommand {
8686 config. writeEmptyFiles = writeEmptyFiles
8787 config. unsignedNumbersMode = unsignedNumbers
8888
89- guard checkModeCompatibility ( ) else {
90- // check would have logged the reason for early exit.
91- return
92- }
89+ try checkModeCompatibility ( )
9390
9491 if let inputSwift = commonOptions. inputSwift {
9592 config. inputSwiftDirectory = inputSwift
@@ -108,18 +105,15 @@ extension SwiftJava.JExtractCommand {
108105 }
109106
110107 /// Check if the configured modes are compatible, and fail if not
111- func checkModeCompatibility( ) -> Bool {
108+ func checkModeCompatibility( ) throws {
112109 if self . mode == . jni {
113110 switch self . unsignedNumbers {
114111 case . annotate:
115- print ( " Error: JNI mode does not support ' \( JExtractUnsignedIntegerMode . wrapGuava) ' Unsigned integer mode! \( Self . helpMessage) " )
116- return false
112+ throw IllegalModeCombinationError ( " JNI mode does not support ' \( JExtractUnsignedIntegerMode . wrapGuava) ' Unsigned integer mode! \( Self . helpMessage) " )
117113 case . wrapGuava:
118114 ( ) // OK
119115 }
120116 }
121-
122- return true
123117 }
124118}
125119
@@ -140,5 +134,12 @@ extension SwiftJava.JExtractCommand {
140134
141135}
142136
137+ struct IllegalModeCombinationError : Error {
138+ let message : String
139+ init ( _ message: String ) {
140+ self . message = message
141+ }
142+ }
143+
143144extension JExtractGenerationMode : ExpressibleByArgument { }
144145extension JExtractUnsignedIntegerMode : ExpressibleByArgument { }
You can’t perform that action at this time.
0 commit comments