@@ -156,11 +156,11 @@ private StartPage createStartPage(GameUI ui, String gameVariant, Class<?> startP
156
156
var constructor = startPageClass .getDeclaredConstructor (GameUI .class );
157
157
return (StartPage ) constructor .newInstance (ui );
158
158
} catch (Exception xx ) {
159
- error ("Could not create start page from class '%s'" .formatted (startPageClass .getSimpleName ()));
159
+ error ("Could not create start page from class '%s'" .formatted (startPageClass .getSimpleName ()), xx );
160
160
throw new IllegalStateException (xx );
161
161
}
162
162
} catch (Exception x ) {
163
- error ("Could not create start page from class '%s'" .formatted (startPageClass .getSimpleName ()));
163
+ error ("Could not create start page from class '%s'" .formatted (startPageClass .getSimpleName ()), x );
164
164
throw new IllegalStateException (x );
165
165
}
166
166
}
@@ -175,7 +175,7 @@ private Game createGameModel(Class<?> modelClass, MapSelector mapSelector, GameC
175
175
? modelClass .getDeclaredConstructor (GameContext .class , MapSelector .class , File .class ).newInstance (gameContext , mapSelector , highScoreFile )
176
176
: modelClass .getDeclaredConstructor (GameContext .class , File .class ).newInstance (gameContext , highScoreFile ));
177
177
} catch (Exception x ) {
178
- error ("Could not create game model from class %s" .formatted (modelClass .getSimpleName ()));
178
+ error ("Could not create game model from class %s" .formatted (modelClass .getSimpleName ()), x );
179
179
throw new RuntimeException (x );
180
180
}
181
181
}
@@ -204,6 +204,10 @@ private void validateGameVariantKey(String key) {
204
204
}
205
205
}
206
206
207
+ private void error (String message , Throwable x ) {
208
+ throw new RuntimeException ("UI building failed: %s" .formatted (message ), x );
209
+ }
210
+
207
211
private void error (String message ) {
208
212
throw new RuntimeException ("UI building failed: %s" .formatted (message ));
209
213
}
0 commit comments