Skip to content

Commit ea8c352

Browse files
committed
feat: DialogService error dialogs will no longer show LOG button since these are for expected exceptions handled by dev, closes #1119
1 parent 5f12483 commit ea8c352

File tree

1 file changed

+2
-32
lines changed

1 file changed

+2
-32
lines changed

fxgl-scene/src/main/kotlin/com/almasb/fxgl/ui/FXGLDialogFactoryServiceProvider.kt

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -220,41 +220,11 @@ class FXGLDialogFactoryServiceProvider : DialogFactoryService() {
220220
}
221221

222222
override fun errorDialog(errorMessage: String, callback: Runnable): Pane {
223-
return messageDialog("Error occurred: $errorMessage", callback)
223+
return errorDialog(RuntimeException(errorMessage), callback)
224224
}
225225

226226
override fun errorDialog(error: Throwable, callback: Runnable): Pane {
227-
val text = createMessage(error.toString())
228-
229-
val btnOK = uiFactory.newButton(localizedStringProperty("dialog.ok"))
230-
btnOK.setOnAction {
231-
callback.run()
232-
}
233-
234-
val btnLog = uiFactory.newButton("LOG")
235-
btnLog.setOnAction {
236-
// val sw = StringWriter()
237-
// val pw = PrintWriter(sw)
238-
// error.printStackTrace(pw)
239-
// pw.close()
240-
//
241-
// try {
242-
// Files.write(Paths.get("LastException.log"), sw.toString().split("\n".toRegex()).dropLastWhile { it.isEmpty() })
243-
// DialogSubState.showMessageBox("Log has been saved as LastException.log")
244-
// } catch (ex: Exception) {
245-
// DialogSubState.showMessageBox("Failed to save log file")
246-
// }
247-
248-
callback.run()
249-
}
250-
251-
val hbox = HBox(btnOK, btnLog)
252-
hbox.alignment = Pos.CENTER
253-
254-
val vbox = VBox(50.0, text, hbox)
255-
vbox.setAlignment(Pos.CENTER)
256-
257-
return wrap(vbox)
227+
return messageDialog(error.toString(), callback)
258228
}
259229

260230
override fun progressDialog(message: String, observable: ReadOnlyDoubleProperty, callback: Runnable): Pane {

0 commit comments

Comments
 (0)