Widen acceptable store exceptions

This commit is contained in:
crschnick 2023-12-22 13:50:18 +00:00
parent af8904ea7a
commit debe83d2f4
7 changed files with 9 additions and 10 deletions

View file

@ -364,7 +364,7 @@ public class GuiDsStoreCreator extends MultiStepComp.Step<CompStructure<?>> {
entry.getValue().validateOrThrow(); entry.getValue().validateOrThrow();
finished.setValue(true); finished.setValue(true);
PlatformThread.runLaterIfNeeded(parent::next); PlatformThread.runLaterIfNeeded(parent::next);
} catch (Exception ex) { } catch (Throwable ex) {
var newMessage = ExceptionConverter.convertMessage(ex); var newMessage = ExceptionConverter.convertMessage(ex);
// Temporary fix for equal error message not showing up again // Temporary fix for equal error message not showing up again
if (Objects.equals(newMessage, messageProp.getValue())) { if (Objects.equals(newMessage, messageProp.getValue())) {

View file

@ -385,12 +385,12 @@ public class DataStoreEntry extends StorageElement {
public void validate() { public void validate() {
try { try {
validateOrThrow(); validateOrThrow();
} catch (Exception ex) { } catch (Throwable ex) {
ErrorEvent.fromThrowable(ex).handle(); ErrorEvent.fromThrowable(ex).handle();
} }
} }
public void validateOrThrow() throws Exception { public void validateOrThrow() throws Throwable {
try { try {
store.checkComplete(); store.checkComplete();
setInRefresh(true); setInRefresh(true);

View file

@ -14,7 +14,7 @@ public class DataStoreEntryRef<T extends DataStore> {
this.entry = entry; this.entry = entry;
} }
public void checkComplete() throws Exception { public void checkComplete() throws Throwable {
getStore().checkComplete(); getStore().checkComplete();
} }

View file

@ -19,12 +19,12 @@ public interface DataStore {
try { try {
checkComplete(); checkComplete();
return true; return true;
} catch (Exception ignored) { } catch (Throwable ignored) {
return false; return false;
} }
} }
default void checkComplete() throws Exception {} default void checkComplete() throws Throwable {}
/** /**
* Casts this instance to the required type without checking whether a cast is possible. * Casts this instance to the required type without checking whether a cast is possible.

View file

@ -8,7 +8,7 @@ public interface GroupStore<T extends DataStore> extends DataStore {
DataStoreEntryRef<? extends T> getParent(); DataStoreEntryRef<? extends T> getParent();
@Override @Override
default void checkComplete() throws Exception { default void checkComplete() throws Throwable {
var p = getParent(); var p = getParent();
if (p != null) { if (p != null) {
p.checkComplete(); p.checkComplete();

View file

@ -7,7 +7,6 @@ import io.xpipe.app.storage.DataStoreEntryRef;
import io.xpipe.app.util.Validators; import io.xpipe.app.util.Validators;
import io.xpipe.core.process.ScriptSnippet; import io.xpipe.core.process.ScriptSnippet;
import io.xpipe.core.process.ShellControl; import io.xpipe.core.process.ShellControl;
import io.xpipe.core.process.ShellStoreState;
import io.xpipe.core.process.SimpleScriptSnippet; import io.xpipe.core.process.SimpleScriptSnippet;
import io.xpipe.core.store.DataStore; import io.xpipe.core.store.DataStore;
import io.xpipe.core.store.DataStoreState; import io.xpipe.core.store.DataStoreState;
@ -179,7 +178,7 @@ public abstract class ScriptStore extends JacksonizedValue implements DataStore,
} }
@Override @Override
public void checkComplete() throws Exception { public void checkComplete() throws Throwable {
Validators.isType(group, ScriptGroupStore.class); Validators.isType(group, ScriptGroupStore.class);
if (scripts != null) { if (scripts != null) {
Validators.contentNonNull(scripts); Validators.contentNonNull(scripts);

View file

@ -75,7 +75,7 @@ public class SimpleScriptStore extends ScriptStore implements ScriptSnippet {
private final ExecutionType executionType; private final ExecutionType executionType;
@Override @Override
public void checkComplete() throws Exception { public void checkComplete() throws Throwable {
Validators.nonNull(group); Validators.nonNull(group);
super.checkComplete(); super.checkComplete();
Validators.nonNull(executionType); Validators.nonNull(executionType);