From e877f5eaa633c4c20a8a54864134a4d8d3c3dfae Mon Sep 17 00:00:00 2001 From: Downforce Agent Date: Fri, 2 Aug 2024 17:09:06 -0500 Subject: [PATCH] better error dialog --- firestar/src/main/java/Gonzo.java | 6 ++++-- firestar/src/main/java/Rizzo.java | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/firestar/src/main/java/Gonzo.java b/firestar/src/main/java/Gonzo.java index c76212a..dfb4ba8 100644 --- a/firestar/src/main/java/Gonzo.java +++ b/firestar/src/main/java/Gonzo.java @@ -212,7 +212,9 @@ public class Gonzo { } catch (Exception e) { System.out.println(e.getMessage()); consoleDisplay.append("CRITICAL FAILURE: " + e.getMessage()); - JOptionPane.showMessageDialog(this.frame, "CRITICAL FAILURE: " + e.getMessage(), "Fatal Error", JOptionPane.ERROR_MESSAGE); + if (e instanceof FirescriptFormatException) {JOptionPane.showMessageDialog(this.frame, "CRITICAL FAILURE: " + e.getMessage() + "\nOne of your mods has a broken FSCRIPT. It cannot be installed.", "Fatal Error", JOptionPane.ERROR_MESSAGE);} else { + JOptionPane.showMessageDialog(this.frame, "CRITICAL FAILURE: " + e.getMessage(), "Fatal Error", JOptionPane.ERROR_MESSAGE); + } frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); AllowExit(); return; @@ -226,7 +228,7 @@ public class Gonzo { } catch (IOException | FirescriptFormatException e) { System.out.println(e.getMessage()); consoleDisplay.append("CRITICAL FAILURE: " + e.getMessage()); - JOptionPane.showMessageDialog(this.frame, "CRITICAL FAILURE: " + e.getMessage(), "Fatal Error", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(this.frame, "CRITICAL FAILURE: Internal FSCRIPT Error. " + e.getMessage() + "\nThis may indicate that Firestar has been corrupted and needs reinstalling.", "Fatal Error", JOptionPane.ERROR_MESSAGE); frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); AllowExit(); return; diff --git a/firestar/src/main/java/Rizzo.java b/firestar/src/main/java/Rizzo.java index b7c7e11..64ecf41 100644 --- a/firestar/src/main/java/Rizzo.java +++ b/firestar/src/main/java/Rizzo.java @@ -89,7 +89,7 @@ public class Rizzo { File newCtx = new File(workingDir + args[1]); System.out.println("Calling new parse: " + Arrays.toString(Arrays.copyOfRange(args, 2, args.length))); parseArgs(Arrays.copyOfRange(args, 2, args.length), newCtx); - } else throw new FirescriptFormatException("fscript", "command '" + args[0] + "' is unknown or used in inappropriate context\n\nOne of your mods has a broken FSCRIPT. It cannot be installed."); + } else throw new FirescriptFormatException("fscript", "command '" + args[0] + "' is unknown or used in inappropriate context"); } else { System.out.println("Parsing Command: " + Arrays.toString(args) + " using context: " + context.getClass().getName() + "@" + context.hashCode()); if (args[0].equals("{")) { @@ -199,7 +199,7 @@ public class Rizzo { } catch (FirescriptFormatException | PatchFailedException | IOException ex) { Logger.getLogger(Rizzo.class.getName()).log(Level.SEVERE, null, ex); } - } else throw new FirescriptFormatException("file", "command '" + args[0] + "' is unknown or used in inappropriate context\n\nOne of your mods has a broken FSCRIPT. It cannot be installed."); + } else throw new FirescriptFormatException("file", "command '" + args[0] + "' is unknown or used in inappropriate context"); } else if (args[0].equalsIgnoreCase("xml")) { System.out.println("fscript: XML called but file does not exist. Using placebo..."); try { @@ -250,7 +250,7 @@ public class Rizzo { } catch (SAXException | IOException | ParserConfigurationException ex) { Logger.getLogger(Rizzo.class.getName()).log(Level.SEVERE, "This usually means there's non-standard formatting from the game developer which your FSCRIPT does not account for.", ex); } - } else throw new FirescriptFormatException("xml", "command '" + args[0] + "' is unknown or used in inappropriate context\n\nOne of your mods has a broken FSCRIPT. It cannot be installed."); + } else throw new FirescriptFormatException("xml", "command '" + args[0] + "' is unknown or used in inappropriate context"); } else { System.out.println("fscript: XML document has no child nodes. Skipping..."); parseArgs(Arrays.copyOfRange(args, 1, args.length), document);