Skip to content

Commit

Permalink
improv: Display generation errors in GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
Griefed committed Aug 10, 2024
1 parent f18e134 commit e74a90a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ createserverpack.gui.createserverpack.about.title=About ServerPackCreator
createserverpack.gui.createserverpack.lazymode=Lazy Mode specified. Prepare for unforeseen consequences, Mr. Freeman.
createserverpack.gui.createserverpack.openfolder.title=Browse server pack?
createserverpack.gui.createserverpack.openfolder.browse=Would you like to browse the newly generated server pack?
createserverpack.gui.createserverpack.openfolder.errors=The following errors were encountered during generation:\n{0}
createserverpack.gui.createserverpack.errors.encountered=Encountered {0} error(s).
createserverpack.gui.createserverpack.errors.modloader.version=Error parsing modloader-version from configfile: {0}. Using latest Forge version.
createserverpack.gui.createserverpack.javaargs=Run Arguments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,21 +176,25 @@ class ControlPanel(
if (guiProps.generationFocusEnabled) {
mainFrame.toFront()
}
if (JOptionPane.showConfirmDialog(
panel.parent,
Translations.createserverpack_gui_createserverpack_openfolder_browse.toString(),
Translations.createserverpack_gui_createserverpack_openfolder_title.toString(),
JOptionPane.YES_NO_OPTION,
JOptionPane.INFORMATION_MESSAGE,
guiProps.infoIcon
) == 0
) {
try {
Desktop.getDesktop().open(generation.serverPack)
if (generation.success) {
if (JOptionPane.showConfirmDialog(
panel.parent,
Translations.createserverpack_gui_createserverpack_openfolder_browse.toString(),
Translations.createserverpack_gui_createserverpack_openfolder_title.toString(),
JOptionPane.YES_NO_OPTION,
JOptionPane.INFORMATION_MESSAGE,
guiProps.infoIcon
) == 0
) {
try {
Desktop.getDesktop().open(generation.serverPack)

} catch (ex: IOException) {
log.error("Error opening file explorer for server pack.", ex)
} catch (ex: IOException) {
log.error("Error opening file explorer for server pack.", ex)
}
}
} else {
generationFailed(generation.errors)
}
} catch (ex: Exception) {
log.error("An error occurred when generating the server pack.", ex)
Expand Down

0 comments on commit e74a90a

Please sign in to comment.