1 package processing.app.helpers;
2 
3 import static processing.app.I18n.tr;
4 
5 public class BasicUserNotifier extends UserNotifier {
6 
7   /**
8    * Show an error message that's actually fatal to the program.
9    * This is an error that can't be recovered. Use showWarning()
10    * for errors that allow P5 to continue running.
11    */
12   @Override
showError(String title, String message, Throwable e, int exit_code)13   public void showError(String title, String message, Throwable e, int exit_code) {
14     if (title == null) title = tr("Error");
15 
16     System.err.println(title + ": " + message);
17 
18     if (e != null) e.printStackTrace();
19     System.exit(exit_code);
20   }
21 
22   @Override
showMessage(String title, String message)23   public void showMessage(String title, String message) {
24     if (title == null) title = tr("Message");
25 
26     System.out.println(title + ": " + message);
27   }
28 
29   /**
30    * Non-fatal error message with optional stack trace side dish.
31    */
32   @Override
showWarning(String title, String message, Exception e)33   public void showWarning(String title, String message, Exception e) {
34     if (title == null) title = tr("Warning");
35 
36     System.out.println(title + ": " + message);
37 
38     if (e != null) e.printStackTrace();
39   }
40 
41 }
42