Add debug message for tracing EmptyStackException and IllegalStateException
This commit is contained in:
@@ -102,10 +102,10 @@ public final class DownloadWizardProvider implements WizardProvider {
|
|||||||
case 1:
|
case 1:
|
||||||
return new ModpackPage(controller);
|
return new ModpackPage(controller);
|
||||||
default:
|
default:
|
||||||
throw new IllegalStateException("Error step " + step + ", subStep " + subStep + ", settings: " + settings);
|
throw new IllegalStateException("Error step " + step + ", subStep " + subStep + ", settings: " + settings + ", pages: " + controller.getPages());
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
throw new IllegalStateException("error step " + step + ", settings: " + settings);
|
throw new IllegalStateException("error step " + step + ", settings: " + settings + ", pages: " + controller.getPages());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,10 +20,7 @@ package org.jackhuang.hmcl.ui.wizard;
|
|||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
import org.jackhuang.hmcl.task.Task;
|
import org.jackhuang.hmcl.task.Task;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.*;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Stack;
|
|
||||||
|
|
||||||
public class WizardController implements Navigation {
|
public class WizardController implements Navigation {
|
||||||
private final WizardDisplayer displayer;
|
private final WizardDisplayer displayer;
|
||||||
@@ -47,6 +44,10 @@ public class WizardController implements Navigation {
|
|||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Node> getPages() {
|
||||||
|
return Collections.unmodifiableList(pages);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
Objects.requireNonNull(provider);
|
Objects.requireNonNull(provider);
|
||||||
@@ -81,6 +82,10 @@ public class WizardController implements Navigation {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPrev(boolean cleanUp) {
|
public void onPrev(boolean cleanUp) {
|
||||||
|
if (!canPrev()) {
|
||||||
|
throw new IllegalStateException("Cannot go backward since this is the back page. Pages: " + pages);
|
||||||
|
}
|
||||||
|
|
||||||
Node page = pages.pop();
|
Node page = pages.pop();
|
||||||
if (cleanUp && page instanceof WizardPage)
|
if (cleanUp && page instanceof WizardPage)
|
||||||
((WizardPage) page).cleanup(settings);
|
((WizardPage) page).cleanup(settings);
|
||||||
|
|||||||
Reference in New Issue
Block a user