better error dialog

This commit is contained in:
Downforce Agent 2024-08-02 17:09:06 -05:00
parent b3a949fe43
commit e877f5eaa6
2 changed files with 7 additions and 5 deletions

View File

@ -212,7 +212,9 @@ public class Gonzo {
} catch (Exception e) { } catch (Exception e) {
System.out.println(e.getMessage()); System.out.println(e.getMessage());
consoleDisplay.append("CRITICAL FAILURE: " + 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); frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
AllowExit(); AllowExit();
return; return;
@ -226,7 +228,7 @@ public class Gonzo {
} catch (IOException | FirescriptFormatException e) { } catch (IOException | FirescriptFormatException e) {
System.out.println(e.getMessage()); System.out.println(e.getMessage());
consoleDisplay.append("CRITICAL FAILURE: " + 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); frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
AllowExit(); AllowExit();
return; return;

View File

@ -89,7 +89,7 @@ public class Rizzo {
File newCtx = new File(workingDir + args[1]); File newCtx = new File(workingDir + args[1]);
System.out.println("Calling new parse: " + Arrays.toString(Arrays.copyOfRange(args, 2, args.length))); System.out.println("Calling new parse: " + Arrays.toString(Arrays.copyOfRange(args, 2, args.length)));
parseArgs(Arrays.copyOfRange(args, 2, args.length), newCtx); 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 { } else {
System.out.println("Parsing Command: " + Arrays.toString(args) + " using context: " + context.getClass().getName() + "@" + context.hashCode()); System.out.println("Parsing Command: " + Arrays.toString(args) + " using context: " + context.getClass().getName() + "@" + context.hashCode());
if (args[0].equals("{")) { if (args[0].equals("{")) {
@ -199,7 +199,7 @@ public class Rizzo {
} catch (FirescriptFormatException | PatchFailedException | IOException ex) { } catch (FirescriptFormatException | PatchFailedException | IOException ex) {
Logger.getLogger(Rizzo.class.getName()).log(Level.SEVERE, null, 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")) { } else if (args[0].equalsIgnoreCase("xml")) {
System.out.println("fscript: XML called but file does not exist. Using placebo..."); System.out.println("fscript: XML called but file does not exist. Using placebo...");
try { try {
@ -250,7 +250,7 @@ public class Rizzo {
} catch (SAXException | IOException | ParserConfigurationException ex) { } 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); 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 { } else {
System.out.println("fscript: XML document has no child nodes. Skipping..."); System.out.println("fscript: XML document has no child nodes. Skipping...");
parseArgs(Arrays.copyOfRange(args, 1, args.length), document); parseArgs(Arrays.copyOfRange(args, 1, args.length), document);