From debe83d2f42fc600a646b85e3b0a24379107c29e Mon Sep 17 00:00:00 2001 From: crschnick Date: Fri, 22 Dec 2023 13:50:18 +0000 Subject: [PATCH] Widen acceptable store exceptions --- .../main/java/io/xpipe/app/comp/store/GuiDsStoreCreator.java | 2 +- app/src/main/java/io/xpipe/app/storage/DataStoreEntry.java | 4 ++-- app/src/main/java/io/xpipe/app/storage/DataStoreEntryRef.java | 2 +- core/src/main/java/io/xpipe/core/store/DataStore.java | 4 ++-- ext/base/src/main/java/io/xpipe/ext/base/GroupStore.java | 2 +- .../src/main/java/io/xpipe/ext/base/script/ScriptStore.java | 3 +-- .../main/java/io/xpipe/ext/base/script/SimpleScriptStore.java | 2 +- 7 files changed, 9 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/comp/store/GuiDsStoreCreator.java b/app/src/main/java/io/xpipe/app/comp/store/GuiDsStoreCreator.java index 659beef15..82cda7ce4 100644 --- a/app/src/main/java/io/xpipe/app/comp/store/GuiDsStoreCreator.java +++ b/app/src/main/java/io/xpipe/app/comp/store/GuiDsStoreCreator.java @@ -364,7 +364,7 @@ public class GuiDsStoreCreator extends MultiStepComp.Step> { entry.getValue().validateOrThrow(); finished.setValue(true); PlatformThread.runLaterIfNeeded(parent::next); - } catch (Exception ex) { + } catch (Throwable ex) { var newMessage = ExceptionConverter.convertMessage(ex); // Temporary fix for equal error message not showing up again if (Objects.equals(newMessage, messageProp.getValue())) { diff --git a/app/src/main/java/io/xpipe/app/storage/DataStoreEntry.java b/app/src/main/java/io/xpipe/app/storage/DataStoreEntry.java index a010d6302..907073da4 100644 --- a/app/src/main/java/io/xpipe/app/storage/DataStoreEntry.java +++ b/app/src/main/java/io/xpipe/app/storage/DataStoreEntry.java @@ -385,12 +385,12 @@ public class DataStoreEntry extends StorageElement { public void validate() { try { validateOrThrow(); - } catch (Exception ex) { + } catch (Throwable ex) { ErrorEvent.fromThrowable(ex).handle(); } } - public void validateOrThrow() throws Exception { + public void validateOrThrow() throws Throwable { try { store.checkComplete(); setInRefresh(true); diff --git a/app/src/main/java/io/xpipe/app/storage/DataStoreEntryRef.java b/app/src/main/java/io/xpipe/app/storage/DataStoreEntryRef.java index 1c2e45a68..eeb16066a 100644 --- a/app/src/main/java/io/xpipe/app/storage/DataStoreEntryRef.java +++ b/app/src/main/java/io/xpipe/app/storage/DataStoreEntryRef.java @@ -14,7 +14,7 @@ public class DataStoreEntryRef { this.entry = entry; } - public void checkComplete() throws Exception { + public void checkComplete() throws Throwable { getStore().checkComplete(); } diff --git a/core/src/main/java/io/xpipe/core/store/DataStore.java b/core/src/main/java/io/xpipe/core/store/DataStore.java index 055417f14..eccacb693 100644 --- a/core/src/main/java/io/xpipe/core/store/DataStore.java +++ b/core/src/main/java/io/xpipe/core/store/DataStore.java @@ -19,12 +19,12 @@ public interface DataStore { try { checkComplete(); return true; - } catch (Exception ignored) { + } catch (Throwable ignored) { 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. diff --git a/ext/base/src/main/java/io/xpipe/ext/base/GroupStore.java b/ext/base/src/main/java/io/xpipe/ext/base/GroupStore.java index 44d1e8390..315b0b0f1 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/GroupStore.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/GroupStore.java @@ -8,7 +8,7 @@ public interface GroupStore extends DataStore { DataStoreEntryRef getParent(); @Override - default void checkComplete() throws Exception { + default void checkComplete() throws Throwable { var p = getParent(); if (p != null) { p.checkComplete(); diff --git a/ext/base/src/main/java/io/xpipe/ext/base/script/ScriptStore.java b/ext/base/src/main/java/io/xpipe/ext/base/script/ScriptStore.java index 1bcbcb903..5af020404 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/script/ScriptStore.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/script/ScriptStore.java @@ -7,7 +7,6 @@ import io.xpipe.app.storage.DataStoreEntryRef; import io.xpipe.app.util.Validators; import io.xpipe.core.process.ScriptSnippet; import io.xpipe.core.process.ShellControl; -import io.xpipe.core.process.ShellStoreState; import io.xpipe.core.process.SimpleScriptSnippet; import io.xpipe.core.store.DataStore; import io.xpipe.core.store.DataStoreState; @@ -179,7 +178,7 @@ public abstract class ScriptStore extends JacksonizedValue implements DataStore, } @Override - public void checkComplete() throws Exception { + public void checkComplete() throws Throwable { Validators.isType(group, ScriptGroupStore.class); if (scripts != null) { Validators.contentNonNull(scripts); diff --git a/ext/base/src/main/java/io/xpipe/ext/base/script/SimpleScriptStore.java b/ext/base/src/main/java/io/xpipe/ext/base/script/SimpleScriptStore.java index 677312a76..254e59d12 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/script/SimpleScriptStore.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/script/SimpleScriptStore.java @@ -75,7 +75,7 @@ public class SimpleScriptStore extends ScriptStore implements ScriptSnippet { private final ExecutionType executionType; @Override - public void checkComplete() throws Exception { + public void checkComplete() throws Throwable { Validators.nonNull(group); super.checkComplete(); Validators.nonNull(executionType);