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 {
86
86
config. writeEmptyFiles = writeEmptyFiles
87
87
config. unsignedNumbersMode = unsignedNumbers
88
88
89
- guard checkModeCompatibility ( ) else {
90
- // check would have logged the reason for early exit.
91
- return
92
- }
89
+ try checkModeCompatibility ( )
93
90
94
91
if let inputSwift = commonOptions. inputSwift {
95
92
config. inputSwiftDirectory = inputSwift
@@ -108,18 +105,15 @@ extension SwiftJava.JExtractCommand {
108
105
}
109
106
110
107
/// Check if the configured modes are compatible, and fail if not
111
- func checkModeCompatibility( ) -> Bool {
108
+ func checkModeCompatibility( ) throws {
112
109
if self . mode == . jni {
113
110
switch self . unsignedNumbers {
114
111
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) " )
117
113
case . wrapGuava:
118
114
( ) // OK
119
115
}
120
116
}
121
-
122
- return true
123
117
}
124
118
}
125
119
@@ -140,5 +134,12 @@ extension SwiftJava.JExtractCommand {
140
134
141
135
}
142
136
137
+ struct IllegalModeCombinationError : Error {
138
+ let message : String
139
+ init ( _ message: String ) {
140
+ self . message = message
141
+ }
142
+ }
143
+
143
144
extension JExtractGenerationMode : ExpressibleByArgument { }
144
145
extension JExtractUnsignedIntegerMode : ExpressibleByArgument { }
You can’t perform that action at this time.
0 commit comments