mirror of
https://github.com/processing/processing4.git
synced 2026-02-12 01:50:44 +01:00
more bulletproofing around bad modes
This commit is contained in:
@@ -788,16 +788,29 @@ public class Base {
|
||||
}
|
||||
|
||||
// Editor.State state = new Editor.State(editors);
|
||||
Editor editor = nextMode.createEditor(this, path, state);
|
||||
Editor editor = null;
|
||||
try {
|
||||
editor = nextMode.createEditor(this, path, state);
|
||||
|
||||
} catch (NoSuchMethodError nsme) {
|
||||
Base.showWarning("Mode out of date",
|
||||
nextMode.getTitle() + " is not compatible with this version of Processing.\n" +
|
||||
"Try updating the Mode or contact its author for a new version.", nsme);
|
||||
} catch (Throwable t) {
|
||||
showBadnessTrace("Mode Problems",
|
||||
"A nasty error occurred while trying to use " + nextMode.getTitle() + ".\n" +
|
||||
"It may not be compatible with this version of Processing.\n" +
|
||||
"Try updating the Mode or contact its author for a new version.", t, false);
|
||||
}
|
||||
if (editor == null) {
|
||||
// if it's not mode[0] already, then don't go into an infinite loop
|
||||
// if the bad mode is the default mode, don't go into an infinite loop
|
||||
// trying to recreate a window with the default mode.
|
||||
Mode defaultMode = getDefaultMode();
|
||||
if (nextMode == defaultMode) {
|
||||
Base.showError("Editor Problems",
|
||||
"An error occurred while trying to change modes.\n" +
|
||||
"We'll have to quit for now because it's an\n" +
|
||||
"unfortunate bit of indigestion.",
|
||||
"unfortunate bit of indigestion with the default Mode.",
|
||||
null);
|
||||
} else {
|
||||
editor = defaultMode.createEditor(this, path, state);
|
||||
@@ -820,6 +833,9 @@ public class Base {
|
||||
|
||||
return editor;
|
||||
|
||||
// } catch (NoSuchMethodError nsme) {
|
||||
// Base.showWarning(title, message);
|
||||
|
||||
} catch (Throwable t) {
|
||||
showBadnessTrace("Terrible News",
|
||||
"A serious error occurred while " +
|
||||
|
||||
@@ -126,6 +126,12 @@ public class ModeContribution extends LocalContribution {
|
||||
if (!existing.containsKey(folder)) {
|
||||
try {
|
||||
contribModes.add(new ModeContribution(base, folder, null));
|
||||
} catch (NoSuchMethodError nsme) {
|
||||
System.err.println(folder.getName() + " contains an incompatible Mode");
|
||||
System.err.println(nsme.getMessage());
|
||||
} catch (NoClassDefFoundError ncdfe) {
|
||||
System.err.println(folder.getName() + " contains an incompatible Mode");
|
||||
System.err.println(ncdfe.getMessage());
|
||||
} catch (IgnorableException ig) {
|
||||
Base.log(ig.getMessage());
|
||||
} catch (Throwable e) {
|
||||
|
||||
Reference in New Issue
Block a user