From a9630648b0620d66bce4500f7c64f3049e451936 Mon Sep 17 00:00:00 2001 From: Joachim Klein Date: Fri, 7 Aug 2015 09:41:49 +0000 Subject: [PATCH] GUIComputationThread: Add method for logging generic Exceptions git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@10482 bbc10eb1-c90d-0410-af57-cb519fbb1720 --- .../userinterface/GUIComputationThread.java | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/prism/src/userinterface/GUIComputationThread.java b/prism/src/userinterface/GUIComputationThread.java index 0c308423..ab14ac9c 100644 --- a/prism/src/userinterface/GUIComputationThread.java +++ b/prism/src/userinterface/GUIComputationThread.java @@ -49,12 +49,35 @@ public class GUIComputationThread extends Thread errorLog(s); errorDialog(s); } - + + /** Report an error for an Exception (in log and popup dialog) */ + public void error(Exception e) + { + if (e instanceof jdd.JDD.CuddOutOfMemoryException) { + error(e.getMessage()+"\nPlease restart PRISM. You can increase the memory for CuDD in the settings..."); + } else if (e instanceof PrismException) { + error(e.getMessage()); + } else { + error(e.toString()+"\nThis is an unexpected error, it might be a good idea to restart PRISM"); + } + } + /** Report an error (in log) */ public void errorLog(String s) { logln("\nError: " + s + "."); } + + /** Report an Exception error (in log) */ + public void errorLog(Exception e) + { + if (e instanceof PrismException || e instanceof jdd.JDD.CuddOutOfMemoryException) { + logln("\nError: " + e.getMessage() + "."); + } else { + logln("\nError: " + e.toString() +"."); + } + } + // send messages to log public void log(Object o) { plug.log(o); }