diff --git a/app/src/main/java/io/xpipe/app/action/AbstractAction.java b/app/src/main/java/io/xpipe/app/action/AbstractAction.java index bed529cf5..1211c4a56 100644 --- a/app/src/main/java/io/xpipe/app/action/AbstractAction.java +++ b/app/src/main/java/io/xpipe/app/action/AbstractAction.java @@ -6,7 +6,7 @@ import io.xpipe.app.core.AppCache; import io.xpipe.app.core.AppI18n; import io.xpipe.app.core.AppLayoutModel; import io.xpipe.app.core.window.AppDialog; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.issue.TrackEvent; import io.xpipe.app.util.DataStoreFormatter; import io.xpipe.app.util.LabelGraphic; @@ -132,14 +132,14 @@ public abstract class AbstractAction { return; } } catch (Throwable t) { - ErrorEvent.fromThrowable(t).handle(); + ErrorEventFactory.fromThrowable(t).handle(); return; } try { executeImpl(); } catch (Throwable t) { - ErrorEvent.fromThrowable(t).handle(); + ErrorEventFactory.fromThrowable(t).handle(); } finally { afterExecute(); synchronized (active) { diff --git a/app/src/main/java/io/xpipe/app/action/ActionProvider.java b/app/src/main/java/io/xpipe/app/action/ActionProvider.java index 101532ed2..4a6f33b17 100644 --- a/app/src/main/java/io/xpipe/app/action/ActionProvider.java +++ b/app/src/main/java/io/xpipe/app/action/ActionProvider.java @@ -1,7 +1,7 @@ package io.xpipe.app.action; import io.xpipe.app.ext.DataStoreProviders; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.issue.TrackEvent; import io.xpipe.core.util.ModuleLayerLoader; @@ -17,7 +17,7 @@ public interface ActionProvider { try { actionProvider.init(); } catch (Throwable t) { - ErrorEvent.fromThrowable(t).handle(); + ErrorEventFactory.fromThrowable(t).handle(); } } TrackEvent.trace("Finished action provider initialization"); diff --git a/app/src/main/java/io/xpipe/app/beacon/AppBeaconServer.java b/app/src/main/java/io/xpipe/app/beacon/AppBeaconServer.java index c12a70ce4..1ed7dbc45 100644 --- a/app/src/main/java/io/xpipe/app/beacon/AppBeaconServer.java +++ b/app/src/main/java/io/xpipe/app/beacon/AppBeaconServer.java @@ -1,6 +1,6 @@ package io.xpipe.app.beacon; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.issue.TrackEvent; import io.xpipe.app.util.DocumentationLink; import io.xpipe.beacon.BeaconConfig; @@ -75,7 +75,7 @@ public class AppBeaconServer { } catch (Exception ex) { // Not terminal! // We can still continue without the running server - ErrorEvent.fromThrowable("Unable to start local http server on port " + INSTANCE.getPort(), ex) + ErrorEventFactory.fromThrowable("Unable to start local http server on port " + INSTANCE.getPort(), ex) .build() .handle(); } @@ -135,7 +135,7 @@ public class AppBeaconServer { t.setDaemon(true); t.setName("http handler"); t.setUncaughtExceptionHandler((t1, e) -> { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); }); return t; }); diff --git a/app/src/main/java/io/xpipe/app/beacon/BeaconRequestHandler.java b/app/src/main/java/io/xpipe/app/beacon/BeaconRequestHandler.java index 22561c0fd..8fc5a1ddc 100644 --- a/app/src/main/java/io/xpipe/app/beacon/BeaconRequestHandler.java +++ b/app/src/main/java/io/xpipe/app/beacon/BeaconRequestHandler.java @@ -1,7 +1,7 @@ package io.xpipe.app.beacon; import io.xpipe.app.core.mode.OperationMode; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.issue.TrackEvent; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.util.ThreadHelper; @@ -106,12 +106,12 @@ public class BeaconRequestHandler implements HttpHandler { response = beaconInterface.handle(exchange, object); } } catch (BeaconClientException clientException) { - ErrorEvent.fromThrowable(clientException).omit().expected().handle(); + ErrorEventFactory.fromThrowable(clientException).omit().expected().handle(); writeError(exchange, new BeaconClientErrorResponse(clientException.getMessage()), 400); return; } catch (BeaconServerException serverException) { var cause = serverException.getCause() != null ? serverException.getCause() : serverException; - var event = ErrorEvent.fromThrowable(cause).omit().handle(); + var event = ErrorEventFactory.fromThrowable(cause).omit().handle(); var link = event.getLink(); writeError(exchange, new BeaconServerErrorResponse(cause, link), 500); return; @@ -119,9 +119,9 @@ public class BeaconRequestHandler implements HttpHandler { // Handle serialization errors as normal exceptions and other IO exceptions as assuming that the connection // is broken if (!ex.getClass().getName().contains("jackson")) { - ErrorEvent.fromThrowable(ex).omit().expected().handle(); + ErrorEventFactory.fromThrowable(ex).omit().expected().handle(); } else { - ErrorEvent.fromThrowable(ex).omit().expected().handle(); + ErrorEventFactory.fromThrowable(ex).omit().expected().handle(); // Make deserialization error message more readable var message = ex.getMessage() .replace("$RequestBuilder", "") @@ -133,7 +133,7 @@ public class BeaconRequestHandler implements HttpHandler { } return; } catch (Throwable other) { - var event = ErrorEvent.fromThrowable(other).omit().expected().handle(); + var event = ErrorEventFactory.fromThrowable(other).omit().expected().handle(); var link = event.getLink(); writeError(exchange, new BeaconServerErrorResponse(other, link), 500); return; @@ -159,10 +159,10 @@ public class BeaconRequestHandler implements HttpHandler { } catch (IOException ioException) { // The exchange implementation might have already sent a response manually if (!"headers already sent".equals(ioException.getMessage())) { - ErrorEvent.fromThrowable(ioException).omit().expected().handle(); + ErrorEventFactory.fromThrowable(ioException).omit().expected().handle(); } } catch (Throwable other) { - var event = ErrorEvent.fromThrowable(other).handle(); + var event = ErrorEventFactory.fromThrowable(other).handle(); var link = event.getLink(); writeError(exchange, new BeaconServerErrorResponse(other, link), 500); } @@ -177,7 +177,7 @@ public class BeaconRequestHandler implements HttpHandler { os.write(bytes); } } catch (IOException ex) { - ErrorEvent.fromThrowable(ex).omit().expected().handle(); + ErrorEventFactory.fromThrowable(ex).omit().expected().handle(); } } diff --git a/app/src/main/java/io/xpipe/app/beacon/BlobManager.java b/app/src/main/java/io/xpipe/app/beacon/BlobManager.java index fc12a1b42..571ec7e8d 100644 --- a/app/src/main/java/io/xpipe/app/beacon/BlobManager.java +++ b/app/src/main/java/io/xpipe/app/beacon/BlobManager.java @@ -1,6 +1,6 @@ package io.xpipe.app.beacon; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.util.ShellTemp; import io.xpipe.beacon.BeaconClientException; @@ -36,7 +36,7 @@ public class BlobManager { } catch (IOException ignored) { } } catch (IOException e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); } } diff --git a/app/src/main/java/io/xpipe/app/beacon/impl/ConnectionAddExchangeImpl.java b/app/src/main/java/io/xpipe/app/beacon/impl/ConnectionAddExchangeImpl.java index b95c0e41d..0ab17b7b6 100644 --- a/app/src/main/java/io/xpipe/app/beacon/impl/ConnectionAddExchangeImpl.java +++ b/app/src/main/java/io/xpipe/app/beacon/impl/ConnectionAddExchangeImpl.java @@ -1,6 +1,6 @@ package io.xpipe.app.beacon.impl; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.storage.DataStorage; import io.xpipe.app.storage.DataStoreEntry; import io.xpipe.beacon.BeaconClientException; @@ -42,10 +42,10 @@ public class ConnectionAddExchangeImpl extends ConnectionAddExchange { } } catch (Throwable ex) { if (ex instanceof ValidationException) { - ErrorEvent.expected(ex); + ErrorEventFactory.expected(ex); } else if (ex instanceof StackOverflowError) { // Cycles in connection graphs can fail hard but are expected - ErrorEvent.expected(ex); + ErrorEventFactory.expected(ex); } throw ex; } finally { diff --git a/app/src/main/java/io/xpipe/app/browser/action/impl/RunCommandInBackgroundActionProvider.java b/app/src/main/java/io/xpipe/app/browser/action/impl/RunCommandInBackgroundActionProvider.java index 0e63c9b5b..fc78d14eb 100644 --- a/app/src/main/java/io/xpipe/app/browser/action/impl/RunCommandInBackgroundActionProvider.java +++ b/app/src/main/java/io/xpipe/app/browser/action/impl/RunCommandInBackgroundActionProvider.java @@ -3,7 +3,7 @@ package io.xpipe.app.browser.action.impl; import io.xpipe.app.browser.action.BrowserAction; import io.xpipe.app.browser.action.BrowserActionProvider; import io.xpipe.app.browser.file.BrowserEntry; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.core.process.CommandBuilder; import io.xpipe.core.process.ProcessOutputException; @@ -56,7 +56,7 @@ public class RunCommandInBackgroundActionProvider implements BrowserActionProvid // Only throw actual error output if (exitCode != 0) { - throw ErrorEvent.expected(ProcessOutputException.of(exitCode, out.get(), err.get())); + throw ErrorEventFactory.expected(ProcessOutputException.of(exitCode, out.get(), err.get())); } } } diff --git a/app/src/main/java/io/xpipe/app/browser/file/BrowserClipboard.java b/app/src/main/java/io/xpipe/app/browser/file/BrowserClipboard.java index e63f82ca4..4afee4563 100644 --- a/app/src/main/java/io/xpipe/app/browser/file/BrowserClipboard.java +++ b/app/src/main/java/io/xpipe/app/browser/file/BrowserClipboard.java @@ -1,7 +1,7 @@ package io.xpipe.app.browser.file; import io.xpipe.app.ext.ProcessControlProvider; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.util.GlobalClipboard; import io.xpipe.core.store.FileEntry; @@ -14,7 +14,6 @@ import javafx.scene.input.Dragboard; import lombok.SneakyThrows; import lombok.Value; -import java.awt.*; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.DataFlavor; import java.io.File; @@ -59,7 +58,7 @@ public class BrowserClipboard { currentCopyClipboard.setValue( new Instance(UUID.randomUUID(), null, entries, BrowserFileTransferMode.COPY)); } catch (Exception e) { - ErrorEvent.fromThrowable(e).expected().omit().handle(); + ErrorEventFactory.fromThrowable(e).expected().omit().handle(); } } }); diff --git a/app/src/main/java/io/xpipe/app/browser/file/BrowserFileListModel.java b/app/src/main/java/io/xpipe/app/browser/file/BrowserFileListModel.java index c6e95025c..4477385cc 100644 --- a/app/src/main/java/io/xpipe/app/browser/file/BrowserFileListModel.java +++ b/app/src/main/java/io/xpipe/app/browser/file/BrowserFileListModel.java @@ -1,6 +1,6 @@ package io.xpipe.app.browser.file; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.core.process.OsType; import io.xpipe.core.store.FileEntry; @@ -129,12 +129,12 @@ public final class BrowserFileListModel { exists = fileSystemModel.getFileSystem().fileExists(newFullPath) || fileSystemModel.getFileSystem().directoryExists(newFullPath); } catch (Exception e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); return old; } if (exists) { - ErrorEvent.fromMessage("Target " + newFullPath + " does already exist") + ErrorEventFactory.fromMessage("Target " + newFullPath + " does already exist") .expected() .handle(); fileSystemModel.refresh(); @@ -152,7 +152,7 @@ public final class BrowserFileListModel { .orElse(old); return b; } catch (Exception e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); return old; } } diff --git a/app/src/main/java/io/xpipe/app/browser/file/BrowserFileSystemHelper.java b/app/src/main/java/io/xpipe/app/browser/file/BrowserFileSystemHelper.java index ecf802a24..e3d1156ef 100644 --- a/app/src/main/java/io/xpipe/app/browser/file/BrowserFileSystemHelper.java +++ b/app/src/main/java/io/xpipe/app/browser/file/BrowserFileSystemHelper.java @@ -1,6 +1,6 @@ package io.xpipe.app.browser.file; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.core.process.OsType; import io.xpipe.core.store.*; @@ -56,7 +56,7 @@ public class BrowserFileSystemHelper { .readStdoutOrThrow(); return !r.isBlank() ? r : null; } catch (Exception ex) { - ErrorEvent.expected(ex); + ErrorEventFactory.expected(ex); throw ex; } } @@ -100,14 +100,14 @@ public class BrowserFileSystemHelper { } if (verifyExists && !model.getFileSystem().directoryExists(path)) { - throw ErrorEvent.expected(new IllegalArgumentException( + throw ErrorEventFactory.expected(new IllegalArgumentException( String.format("Directory %s does not exist or is not accessible", path))); } try { model.getFileSystem().directoryAccessible(path); } catch (Exception ex) { - ErrorEvent.expected(ex); + ErrorEventFactory.expected(ex); throw ex; } } @@ -131,7 +131,7 @@ public class BrowserFileSystemHelper { try { file.getFileSystem().delete(file.getPath()); } catch (Throwable t) { - ErrorEvent.fromThrowable(t).handle(); + ErrorEventFactory.fromThrowable(t).handle(); } } } diff --git a/app/src/main/java/io/xpipe/app/browser/file/BrowserFileSystemTabModel.java b/app/src/main/java/io/xpipe/app/browser/file/BrowserFileSystemTabModel.java index 667dddd84..85a6085b8 100644 --- a/app/src/main/java/io/xpipe/app/browser/file/BrowserFileSystemTabModel.java +++ b/app/src/main/java/io/xpipe/app/browser/file/BrowserFileSystemTabModel.java @@ -11,7 +11,7 @@ import io.xpipe.app.core.window.AppMainWindow; import io.xpipe.app.ext.ProcessControlProvider; import io.xpipe.app.ext.ShellStore; import io.xpipe.app.ext.WrapperFileSystem; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.storage.DataStoreEntryRef; import io.xpipe.app.terminal.*; @@ -140,7 +140,7 @@ public final class BrowserFileSystemTabModel extends BrowserStoreSessionTab> try { var source = currentPath.asLocalPath(); if (!Files.exists(source)) { - ErrorEvent.fromMessage("Unable to resolve local file path " + source) + ErrorEventFactory.fromMessage("Unable to resolve local file path " + source) .expected() .handle(); return; @@ -131,7 +131,7 @@ public class ContextualFileReferenceChoiceComp extends Comp> filePath.setValue(FilePath.of(syncedTarget)); }); } catch (Exception e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); } }); gitShareButton.tooltipKey("gitShareFileTooltip"); diff --git a/app/src/main/java/io/xpipe/app/comp/base/FileDropOverlayComp.java b/app/src/main/java/io/xpipe/app/comp/base/FileDropOverlayComp.java index 16c0abc0a..0b25dc0e2 100644 --- a/app/src/main/java/io/xpipe/app/comp/base/FileDropOverlayComp.java +++ b/app/src/main/java/io/xpipe/app/comp/base/FileDropOverlayComp.java @@ -2,7 +2,7 @@ package io.xpipe.app.comp.base; import io.xpipe.app.comp.Comp; import io.xpipe.app.comp.CompStructure; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.core.util.FailableConsumer; import javafx.geometry.Pos; @@ -73,7 +73,7 @@ public class FileDropOverlayComp> extends Comp> { return file; } catch (IOException e) { // Any possible IO errors can occur here - ErrorEvent.fromThrowable(e).expected().handle(); + ErrorEventFactory.fromThrowable(e).expected().handle(); return null; } } @@ -155,7 +155,7 @@ public class MarkdownComp extends Comp> { WEB_VIEW_SUPPORTED = true; sp.getChildren().addAll(wv); } catch (Throwable t) { - ErrorEvent.fromThrowable(t).handle(); + ErrorEventFactory.fromThrowable(t).handle(); WEB_VIEW_SUPPORTED = false; } } diff --git a/app/src/main/java/io/xpipe/app/core/AppArguments.java b/app/src/main/java/io/xpipe/app/core/AppArguments.java index 239e1b9f9..509a97f19 100644 --- a/app/src/main/java/io/xpipe/app/core/AppArguments.java +++ b/app/src/main/java/io/xpipe/app/core/AppArguments.java @@ -1,6 +1,6 @@ package io.xpipe.app.core; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.issue.LogErrorHandler; import io.xpipe.core.util.XPipeDaemonMode; @@ -62,14 +62,14 @@ public class AppArguments { public static LauncherCommand resolveLauncher(String[] args) { var cmd = new CommandLine(new LauncherCommand()); cmd.setExecutionExceptionHandler((ex, commandLine, parseResult) -> { - var event = ErrorEvent.fromThrowable(ex).term().build(); + var event = ErrorEventFactory.fromThrowable(ex).term().build(); // Print error in case we launched from the command-line new LogErrorHandler().handle(event); event.handle(); return 1; }); cmd.setParameterExceptionHandler((ex, args1) -> { - var event = ErrorEvent.fromThrowable(ex).term().expected().build(); + var event = ErrorEventFactory.fromThrowable(ex).term().expected().build(); // Print error in case we launched from the command-line new LogErrorHandler().handle(event); event.handle(); @@ -89,7 +89,7 @@ public class AppArguments { var converted = t instanceof CommandLine.UnmatchedArgumentException u ? new IllegalArgumentException(u.getMessage()) : t; - var e = ErrorEvent.fromThrowable(converted).expected().term().build(); + var e = ErrorEventFactory.fromThrowable(converted).expected().term().build(); // Print error in case we launched from the command-line new LogErrorHandler().handle(e); e.handle(); diff --git a/app/src/main/java/io/xpipe/app/core/AppCache.java b/app/src/main/java/io/xpipe/app/core/AppCache.java index 61f6b9149..d8f67eeee 100644 --- a/app/src/main/java/io/xpipe/app/core/AppCache.java +++ b/app/src/main/java/io/xpipe/app/core/AppCache.java @@ -1,6 +1,6 @@ package io.xpipe.app.core; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.core.util.JacksonMapper; import com.fasterxml.jackson.databind.ObjectMapper; @@ -34,7 +34,7 @@ public class AppCache { try { FileUtils.cleanDirectory(getBasePath().toFile()); } catch (IOException e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); } } @@ -65,7 +65,7 @@ public class AppCache { return r; } } catch (Exception ex) { - ErrorEvent.fromThrowable("Could not parse cached data for key " + key, ex) + ErrorEventFactory.fromThrowable("Could not parse cached data for key " + key, ex) .omit() .expected() .handle(); @@ -88,7 +88,7 @@ public class AppCache { return tree.asBoolean(); } catch (Exception ex) { - ErrorEvent.fromThrowable("Could not parse cached data for key " + key, ex) + ErrorEventFactory.fromThrowable("Could not parse cached data for key " + key, ex) .omit() .expected() .handle(); @@ -105,7 +105,7 @@ public class AppCache { FileUtils.forceMkdirParent(path.toFile()); JacksonMapper.getDefault().writeValue(path.toFile(), val); } catch (Exception e) { - ErrorEvent.fromThrowable("Could not write cache data for key " + key, e) + ErrorEventFactory.fromThrowable("Could not write cache data for key " + key, e) .omitted(true) .expected() .build() @@ -120,7 +120,7 @@ public class AppCache { var t = Files.getLastModifiedTime(path); return Optional.of(t.toInstant()); } catch (Exception e) { - ErrorEvent.fromThrowable("Could not get modified date for " + key, e) + ErrorEventFactory.fromThrowable("Could not get modified date for " + key, e) .omitted(true) .expected() .build() diff --git a/app/src/main/java/io/xpipe/app/core/AppDataLock.java b/app/src/main/java/io/xpipe/app/core/AppDataLock.java index 5ea8cb1fa..535f5997a 100644 --- a/app/src/main/java/io/xpipe/app/core/AppDataLock.java +++ b/app/src/main/java/io/xpipe/app/core/AppDataLock.java @@ -1,7 +1,6 @@ package io.xpipe.app.core; -import io.xpipe.app.issue.ErrorEvent; - +import io.xpipe.app.issue.ErrorEventFactory; import org.apache.commons.io.FileUtils; import java.io.RandomAccessFile; @@ -37,7 +36,7 @@ public class AppDataLock { lock = channel.tryLock(); return lock != null; } catch (Exception ex) { - ErrorEvent.fromThrowable(ex).build().handle(); + ErrorEventFactory.fromThrowable(ex).build().handle(); return false; } } @@ -53,7 +52,7 @@ public class AppDataLock { lock = null; channel = null; } catch (Exception ex) { - ErrorEvent.fromThrowable(ex).build().handle(); + ErrorEventFactory.fromThrowable(ex).build().handle(); } } } diff --git a/app/src/main/java/io/xpipe/app/core/AppDesktopIntegration.java b/app/src/main/java/io/xpipe/app/core/AppDesktopIntegration.java index 3751ae9b5..12c5ba6ec 100644 --- a/app/src/main/java/io/xpipe/app/core/AppDesktopIntegration.java +++ b/app/src/main/java/io/xpipe/app/core/AppDesktopIntegration.java @@ -2,7 +2,7 @@ package io.xpipe.app.core; import io.xpipe.app.Main; import io.xpipe.app.core.mode.OperationMode; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.storage.DataStorageUserHandler; import io.xpipe.app.util.PlatformState; @@ -79,12 +79,12 @@ public class AppDesktopIntegration { Taskbar.getTaskbar().setIconImage(awtIcon); } } catch (Exception ex) { - ErrorEvent.fromThrowable(ex).omitted(true).build().handle(); + ErrorEventFactory.fromThrowable(ex).omitted(true).build().handle(); } } } } catch (Throwable ex) { - ErrorEvent.fromThrowable(ex).term().handle(); + ErrorEventFactory.fromThrowable(ex).term().handle(); } } } diff --git a/app/src/main/java/io/xpipe/app/core/AppExtensionManager.java b/app/src/main/java/io/xpipe/app/core/AppExtensionManager.java index e2591cfae..c59182eec 100644 --- a/app/src/main/java/io/xpipe/app/core/AppExtensionManager.java +++ b/app/src/main/java/io/xpipe/app/core/AppExtensionManager.java @@ -2,7 +2,7 @@ package io.xpipe.app.core; import io.xpipe.app.ext.ExtensionException; import io.xpipe.app.ext.ProcessControlProvider; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.issue.TrackEvent; import io.xpipe.app.util.ModuleAccess; import io.xpipe.core.process.OsType; @@ -43,7 +43,7 @@ public class AppExtensionManager { try { ProcessControlProvider.init(INSTANCE.extendedLayer); ModuleLayerLoader.loadAll(INSTANCE.extendedLayer, t -> { - ErrorEvent.fromThrowable(t).handle(); + ErrorEventFactory.fromThrowable(t).handle(); }); } catch (Throwable t) { throw ExtensionException.corrupt("Service provider initialization failed", t); @@ -186,7 +186,7 @@ public class AppExtensionManager { return Optional.of(mod); } } catch (Throwable t) { - ErrorEvent.fromThrowable(t) + ErrorEventFactory.fromThrowable(t) .description("Unable to load extension from " + dir + ". Is the installation corrupted?") .handle(); } diff --git a/app/src/main/java/io/xpipe/app/core/AppFileWatcher.java b/app/src/main/java/io/xpipe/app/core/AppFileWatcher.java index a607e5a43..dce6eba88 100644 --- a/app/src/main/java/io/xpipe/app/core/AppFileWatcher.java +++ b/app/src/main/java/io/xpipe/app/core/AppFileWatcher.java @@ -1,6 +1,6 @@ package io.xpipe.app.core; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.issue.TrackEvent; import io.xpipe.app.util.ThreadHelper; @@ -53,7 +53,7 @@ public class AppFileWatcher { try { watchService = FileSystems.getDefault().newWatchService(); } catch (IOException e) { - ErrorEvent.fromThrowable( + ErrorEventFactory.fromThrowable( "Unable to initialize file watcher. Watching and updating files in the file browser will be unavailable.", e) .expected() @@ -79,7 +79,7 @@ public class AppFileWatcher { break; } catch (Exception ex) { // Catch all other exceptions to not terminate this thread if an error occurs! - ErrorEvent.fromThrowable(ex).handle(); + ErrorEventFactory.fromThrowable(ex).handle(); } // Don't sleep, since polling the directories always sleeps for some ms @@ -100,13 +100,13 @@ public class AppFileWatcher { try { watchService.close(); } catch (IOException e) { - ErrorEvent.fromThrowable(e).omit().handle(); + ErrorEventFactory.fromThrowable(e).omit().handle(); } try { watcherThread.join(); } catch (InterruptedException e) { - ErrorEvent.fromThrowable(e).omit().handle(); + ErrorEventFactory.fromThrowable(e).omit().handle(); } } @@ -132,7 +132,7 @@ public class AppFileWatcher { dir.register(AppFileWatcher.this.watchService, ENTRY_CREATE, ENTRY_MODIFY, ENTRY_DELETE); Files.list(dir).filter(Files::isDirectory).forEach(this::createRecursiveWatchers); } catch (IOException e) { - ErrorEvent.fromThrowable(e).omit().handle(); + ErrorEventFactory.fromThrowable(e).omit().handle(); } } @@ -176,7 +176,7 @@ public class AppFileWatcher { try { file.register(AppFileWatcher.this.watchService, ENTRY_CREATE, ENTRY_MODIFY, ENTRY_DELETE); } catch (IOException e) { - ErrorEvent.fromThrowable(e).omit().handle(); + ErrorEventFactory.fromThrowable(e).omit().handle(); } } diff --git a/app/src/main/java/io/xpipe/app/core/AppI18n.java b/app/src/main/java/io/xpipe/app/core/AppI18n.java index a1686a60a..9a006d8a5 100644 --- a/app/src/main/java/io/xpipe/app/core/AppI18n.java +++ b/app/src/main/java/io/xpipe/app/core/AppI18n.java @@ -1,6 +1,6 @@ package io.xpipe.app.core; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.issue.TrackEvent; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.prefs.SupportedLocale; @@ -108,7 +108,7 @@ public class AppI18n { Locale.setDefault(n != null ? n.getLocale() : Locale.ENGLISH); }); } catch (Exception e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); } }); }); diff --git a/app/src/main/java/io/xpipe/app/core/AppI18nData.java b/app/src/main/java/io/xpipe/app/core/AppI18nData.java index f89926524..bd52e913f 100644 --- a/app/src/main/java/io/xpipe/app/core/AppI18nData.java +++ b/app/src/main/java/io/xpipe/app/core/AppI18nData.java @@ -1,6 +1,6 @@ package io.xpipe.app.core; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.issue.TrackEvent; import io.xpipe.app.prefs.SupportedLocale; import io.xpipe.core.util.XPipeInstallation; @@ -82,7 +82,7 @@ public class AppI18nData { lineCounter.incrementAndGet(); }); } catch (IOException ex) { - ErrorEvent.fromThrowable(ex).omitted(true).build().handle(); + ErrorEventFactory.fromThrowable(ex).omitted(true).build().handle(); } return FileVisitResult.CONTINUE; } @@ -109,7 +109,7 @@ public class AppI18nData { try (var in = Files.newInputStream(file)) { markdownDocumentations.put(name, new String(in.readAllBytes(), StandardCharsets.UTF_8)); } catch (IOException ex) { - ErrorEvent.fromThrowable(ex).omitted(true).build().handle(); + ErrorEventFactory.fromThrowable(ex).omitted(true).build().handle(); } return FileVisitResult.CONTINUE; } diff --git a/app/src/main/java/io/xpipe/app/core/AppImages.java b/app/src/main/java/io/xpipe/app/core/AppImages.java index 482b2ffce..a79eef434 100644 --- a/app/src/main/java/io/xpipe/app/core/AppImages.java +++ b/app/src/main/java/io/xpipe/app/core/AppImages.java @@ -1,6 +1,6 @@ package io.xpipe.app.core; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.issue.TrackEvent; import javafx.scene.image.Image; @@ -153,7 +153,7 @@ public class AppImages { try (var in = Files.newInputStream(p)) { return new Image(in, -1, -1, true, true); } catch (IOException e) { - ErrorEvent.fromThrowable(e).omitted(true).build().handle(); + ErrorEventFactory.fromThrowable(e).omitted(true).build().handle(); return DEFAULT_IMAGE; } } diff --git a/app/src/main/java/io/xpipe/app/core/AppInstance.java b/app/src/main/java/io/xpipe/app/core/AppInstance.java index b1b6a5dfc..7dd85d4b2 100644 --- a/app/src/main/java/io/xpipe/app/core/AppInstance.java +++ b/app/src/main/java/io/xpipe/app/core/AppInstance.java @@ -2,7 +2,7 @@ package io.xpipe.app.core; import io.xpipe.app.beacon.AppBeaconServer; import io.xpipe.app.core.mode.OperationMode; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.issue.TrackEvent; import io.xpipe.app.util.ThreadHelper; import io.xpipe.beacon.BeaconClient; @@ -73,7 +73,7 @@ public class AppInstance { } var cli = XPipeInstallation.getLocalDefaultCliExecutable(); - ErrorEvent.fromThrowable( + ErrorEventFactory.fromThrowable( "Unable to connect to existing running daemon instance as it did not respond." + " Either try to kill the process xpiped manually or use the command \"" + cli @@ -92,7 +92,7 @@ public class AppInstance { .arguments(List.of(e.getURI().toString())) .build()); } catch (Exception ex) { - ErrorEvent.fromThrowable(ex).expected().omit().handle(); + ErrorEventFactory.fromThrowable(ex).expected().omit().handle(); } }); ThreadHelper.sleep(1000); diff --git a/app/src/main/java/io/xpipe/app/core/AppLogs.java b/app/src/main/java/io/xpipe/app/core/AppLogs.java index 0f8588b23..d7f0b18e7 100644 --- a/app/src/main/java/io/xpipe/app/core/AppLogs.java +++ b/app/src/main/java/io/xpipe/app/core/AppLogs.java @@ -1,6 +1,6 @@ package io.xpipe.app.core; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.issue.TrackEvent; import io.xpipe.core.util.Deobfuscator; @@ -120,7 +120,7 @@ public class AppLogs { } catch (Exception ex) { // It can happen that another instance is running that is locking a log file // Since we initialized before checking for another instance, this might fail - ErrorEvent.fromThrowable(ex).expected().omit().handle(); + ErrorEventFactory.fromThrowable(ex).expected().omit().handle(); } } @@ -143,7 +143,7 @@ public class AppLogs { var buf = new BufferedOutputStream(fos); outFileStream = new PrintStream(buf, false); } catch (Exception ex) { - ErrorEvent.fromThrowable(ex).build().handle(); + ErrorEventFactory.fromThrowable(ex).build().handle(); } } diff --git a/app/src/main/java/io/xpipe/app/core/AppOpenArguments.java b/app/src/main/java/io/xpipe/app/core/AppOpenArguments.java index 7260132d8..eeac2159f 100644 --- a/app/src/main/java/io/xpipe/app/core/AppOpenArguments.java +++ b/app/src/main/java/io/xpipe/app/core/AppOpenArguments.java @@ -5,7 +5,7 @@ import io.xpipe.app.action.ActionProvider; import io.xpipe.app.action.LauncherActionProvider; import io.xpipe.app.browser.action.impl.OpenDirectoryActionProvider; import io.xpipe.app.core.mode.OperationMode; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.issue.TrackEvent; import io.xpipe.app.storage.DataStorage; import io.xpipe.core.store.FilePath; @@ -53,7 +53,7 @@ public class AppOpenArguments { try { all.addAll(parseActions(s)); } catch (Exception e) { - ErrorEvent.fromThrowable(e).omit().handle(); + ErrorEventFactory.fromThrowable(e).omit().handle(); } }); @@ -87,7 +87,7 @@ public class AppOpenArguments { try { a = ((LauncherActionProvider) found.get()).createAction(uri); } catch (Exception e) { - ErrorEvent.fromThrowable(e).omit().expected().handle(); + ErrorEventFactory.fromThrowable(e).omit().expected().handle(); return List.of(); } return a != null ? List.of(a) : List.of(); diff --git a/app/src/main/java/io/xpipe/app/core/AppProperties.java b/app/src/main/java/io/xpipe/app/core/AppProperties.java index 7e66358e3..6f1e08210 100644 --- a/app/src/main/java/io/xpipe/app/core/AppProperties.java +++ b/app/src/main/java/io/xpipe/app/core/AppProperties.java @@ -1,7 +1,7 @@ package io.xpipe.app.core; import io.xpipe.app.core.check.AppUserDirectoryCheck; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.issue.TrackEvent; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.core.util.XPipeDaemonMode; @@ -78,7 +78,7 @@ public class AppProperties { } }); } catch (IOException e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); } } var referenceDir = Files.exists(appDir) ? appDir : Path.of(System.getProperty("user.dir")); diff --git a/app/src/main/java/io/xpipe/app/core/AppResources.java b/app/src/main/java/io/xpipe/app/core/AppResources.java index ec0bc9119..a88bdb32f 100644 --- a/app/src/main/java/io/xpipe/app/core/AppResources.java +++ b/app/src/main/java/io/xpipe/app/core/AppResources.java @@ -1,6 +1,6 @@ package io.xpipe.app.core; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.core.util.FailableConsumer; import io.xpipe.modulefs.ModuleFileSystem; @@ -62,7 +62,7 @@ public class AppResources { var url = f.getWrappedPath().toUri().toURL(); return Optional.of(url); } catch (IOException e) { - ErrorEvent.fromThrowable(e).omitted(true).build().handle(); + ErrorEventFactory.fromThrowable(e).omitted(true).build().handle(); return Optional.empty(); } } @@ -86,7 +86,7 @@ public class AppResources { var f = fs.getPath(module.replace('.', '/') + "/resources/" + file); con.accept(f); } catch (IOException e) { - ErrorEvent.fromThrowable(e).omitted(true).build().handle(); + ErrorEventFactory.fromThrowable(e).omitted(true).build().handle(); } } @@ -97,7 +97,7 @@ public class AppResources { var f = fs.getPath(path); con.accept(f); } catch (IOException e) { - ErrorEvent.fromThrowable(e).omitted(true).build().handle(); + ErrorEventFactory.fromThrowable(e).omitted(true).build().handle(); } } @@ -125,7 +125,7 @@ public class AppResources { con.accept(f); } catch (Exception e) { - ErrorEvent.fromThrowable(e).omitted(true).build().handle(); + ErrorEventFactory.fromThrowable(e).omitted(true).build().handle(); } return true; } diff --git a/app/src/main/java/io/xpipe/app/core/AppSid.java b/app/src/main/java/io/xpipe/app/core/AppSid.java index f175cad73..c6b8a0812 100644 --- a/app/src/main/java/io/xpipe/app/core/AppSid.java +++ b/app/src/main/java/io/xpipe/app/core/AppSid.java @@ -1,6 +1,6 @@ package io.xpipe.app.core; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.issue.TrackEvent; import io.xpipe.core.process.OsType; @@ -28,7 +28,7 @@ public class AppSid { hasSetsid = p.exitValue() == 0; } } catch (Exception ex) { - ErrorEvent.fromThrowable(ex).omit().expected().handle(); + ErrorEventFactory.fromThrowable(ex).omit().expected().handle(); } if (hasSetsid) { @@ -50,7 +50,7 @@ public class AppSid { func.invoke(new Object[0]); TrackEvent.info("Successfully set process sid"); } catch (Throwable t) { - ErrorEvent.fromThrowable(t).omit().handle(); + ErrorEventFactory.fromThrowable(t).omit().handle(); } } } diff --git a/app/src/main/java/io/xpipe/app/core/AppStyle.java b/app/src/main/java/io/xpipe/app/core/AppStyle.java index 84bcd1356..967c20b0b 100644 --- a/app/src/main/java/io/xpipe/app/core/AppStyle.java +++ b/app/src/main/java/io/xpipe/app/core/AppStyle.java @@ -1,6 +1,6 @@ package io.xpipe.app.core; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.issue.TrackEvent; import io.xpipe.app.prefs.AppPrefs; @@ -78,7 +78,7 @@ public class AppStyle { STYLESHEET_CONTENTS.put(file, s); } } catch (IOException ex) { - ErrorEvent.fromThrowable(ex).omitted(true).build().handle(); + ErrorEventFactory.fromThrowable(ex).omitted(true).build().handle(); } return FileVisitResult.CONTINUE; } diff --git a/app/src/main/java/io/xpipe/app/core/AppTheme.java b/app/src/main/java/io/xpipe/app/core/AppTheme.java index b9f4411fd..7dbb726b3 100644 --- a/app/src/main/java/io/xpipe/app/core/AppTheme.java +++ b/app/src/main/java/io/xpipe/app/core/AppTheme.java @@ -2,7 +2,7 @@ package io.xpipe.app.core; import io.xpipe.app.core.window.AppMainWindow; import io.xpipe.app.ext.PrefsChoiceValue; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.issue.TrackEvent; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.util.ColorHelper; @@ -124,9 +124,9 @@ public class AppTheme { }); } catch (IllegalStateException ex) { // The platform preferences are sometimes not initialized yet - ErrorEvent.fromThrowable(ex).expected().omit().handle(); + ErrorEventFactory.fromThrowable(ex).expected().omit().handle(); } catch (Throwable t) { - ErrorEvent.fromThrowable(t).omit().handle(); + ErrorEventFactory.fromThrowable(t).omit().handle(); } var t = AppPrefs.get().theme().getValue(); @@ -200,7 +200,7 @@ public class AppTheme { } } catch (IllegalStateException ex) { // The platform preferences are sometimes not initialized yet - ErrorEvent.fromThrowable(ex).expected().omit().handle(); + ErrorEventFactory.fromThrowable(ex).expected().omit().handle(); } catch (Exception ex) { // The color scheme query can fail if the toolkit is not initialized properly AppPrefs.get().theme.setValue(Theme.getDefaultLightTheme()); diff --git a/app/src/main/java/io/xpipe/app/core/AppTrayIcon.java b/app/src/main/java/io/xpipe/app/core/AppTrayIcon.java index acd68c0cd..678677888 100644 --- a/app/src/main/java/io/xpipe/app/core/AppTrayIcon.java +++ b/app/src/main/java/io/xpipe/app/core/AppTrayIcon.java @@ -1,7 +1,7 @@ package io.xpipe.app.core; import io.xpipe.app.core.mode.OperationMode; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.core.process.OsType; import java.awt.*; @@ -63,7 +63,7 @@ public class AppTrayIcon { try { return ImageIO.read(iconImagePath); } catch (IOException e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); return AppImages.toAwtImage(AppImages.DEFAULT_IMAGE); } } @@ -89,7 +89,7 @@ public class AppTrayIcon { tray.add(this.trayIcon); } catch (Exception e) { // This can sometimes fail on Linux - ErrorEvent.fromThrowable("Unable to add TrayIcon", e).expected().handle(); + ErrorEventFactory.fromThrowable("Unable to add TrayIcon", e).expected().handle(); } }); } diff --git a/app/src/main/java/io/xpipe/app/core/AppWindowsShutdown.java b/app/src/main/java/io/xpipe/app/core/AppWindowsShutdown.java index 97acc9ea0..8be3105fc 100644 --- a/app/src/main/java/io/xpipe/app/core/AppWindowsShutdown.java +++ b/app/src/main/java/io/xpipe/app/core/AppWindowsShutdown.java @@ -1,7 +1,7 @@ package io.xpipe.app.core; import io.xpipe.app.core.mode.OperationMode; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.issue.TrackEvent; import io.xpipe.app.util.PlatformState; import io.xpipe.app.util.ThreadHelper; @@ -30,7 +30,7 @@ public class AppWindowsShutdown { PROC.hwnd = hwnd; PROC.hhook = User32.INSTANCE.SetWindowsHookEx(4, PROC, null, windowThreadID); } catch (Throwable t) { - ErrorEvent.fromThrowable(t).omit().handle(); + ErrorEventFactory.fromThrowable(t).omit().handle(); } } diff --git a/app/src/main/java/io/xpipe/app/core/check/AppHomebrewCoreutilsCheck.java b/app/src/main/java/io/xpipe/app/core/check/AppHomebrewCoreutilsCheck.java index e57b77007..7e6e83ed7 100644 --- a/app/src/main/java/io/xpipe/app/core/check/AppHomebrewCoreutilsCheck.java +++ b/app/src/main/java/io/xpipe/app/core/check/AppHomebrewCoreutilsCheck.java @@ -1,6 +1,6 @@ package io.xpipe.app.core.check; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.core.process.OsType; import io.xpipe.core.store.FileNames; @@ -29,7 +29,7 @@ public class AppHomebrewCoreutilsCheck { var loc = checkCoreutils(); if (loc.isPresent()) { - ErrorEvent.fromMessage("You have the homebrew coreutils package installed and added to your PATH at " + ErrorEventFactory.fromMessage("You have the homebrew coreutils package installed and added to your PATH at " + loc.get() + "." + " The coreutils commands overwrite and are incompatible to the native macOS commands, which XPipe expects." + " Please remove the coreutils commands from your PATH prior to launching XPipe.") diff --git a/app/src/main/java/io/xpipe/app/core/check/AppJavaOptionsCheck.java b/app/src/main/java/io/xpipe/app/core/check/AppJavaOptionsCheck.java index cf69ea529..d0c1c8830 100644 --- a/app/src/main/java/io/xpipe/app/core/check/AppJavaOptionsCheck.java +++ b/app/src/main/java/io/xpipe/app/core/check/AppJavaOptionsCheck.java @@ -1,7 +1,7 @@ package io.xpipe.app.core.check; import io.xpipe.app.core.AppCache; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; public class AppJavaOptionsCheck { @@ -15,7 +15,7 @@ public class AppJavaOptionsCheck { return; } - ErrorEvent.fromMessage( + ErrorEventFactory.fromMessage( "You have configured the global environment variable _JAVA_OPTIONS=%s on your system." .formatted(env) + " This will forcefully apply all custom JVM options to XPipe and can cause a variety of different issues." diff --git a/app/src/main/java/io/xpipe/app/core/check/AppPathCorruptCheck.java b/app/src/main/java/io/xpipe/app/core/check/AppPathCorruptCheck.java index cfe7b05d8..e4fd64a93 100644 --- a/app/src/main/java/io/xpipe/app/core/check/AppPathCorruptCheck.java +++ b/app/src/main/java/io/xpipe/app/core/check/AppPathCorruptCheck.java @@ -1,6 +1,6 @@ package io.xpipe.app.core.check; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.util.LocalExec; import io.xpipe.core.process.OsType; @@ -16,7 +16,7 @@ public class AppPathCorruptCheck { return; } - ErrorEvent.fromMessage( + ErrorEventFactory.fromMessage( "Your system PATH looks to be corrupt, essential system tools are not available. This will cause XPipe to not function correctly. Please make sure to fix your PATH environment variable to include the base Windows tools.") .expected() .handle(); diff --git a/app/src/main/java/io/xpipe/app/core/check/AppRosettaCheck.java b/app/src/main/java/io/xpipe/app/core/check/AppRosettaCheck.java index 1e8185f69..468802364 100644 --- a/app/src/main/java/io/xpipe/app/core/check/AppRosettaCheck.java +++ b/app/src/main/java/io/xpipe/app/core/check/AppRosettaCheck.java @@ -1,7 +1,7 @@ package io.xpipe.app.core.check; import io.xpipe.app.core.AppProperties; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.util.DocumentationLink; import io.xpipe.app.util.LocalShell; import io.xpipe.core.process.OsType; @@ -25,7 +25,7 @@ public class AppRosettaCheck { } if (ret.get().equals("1")) { - ErrorEvent.fromMessage("You are running the Intel version of XPipe on an Apple Silicon system." + ErrorEventFactory.fromMessage("You are running the Intel version of XPipe on an Apple Silicon system." + " There is a native build available that comes with much better performance." + " Please install that one instead.") .documentationLink(DocumentationLink.MACOS_SETUP) diff --git a/app/src/main/java/io/xpipe/app/core/check/AppShellChecker.java b/app/src/main/java/io/xpipe/app/core/check/AppShellChecker.java index 5e280b93e..fb0cf9994 100644 --- a/app/src/main/java/io/xpipe/app/core/check/AppShellChecker.java +++ b/app/src/main/java/io/xpipe/app/core/check/AppShellChecker.java @@ -1,7 +1,7 @@ package io.xpipe.app.core.check; import io.xpipe.app.ext.ProcessControlProvider; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.util.LocalShell; import io.xpipe.app.util.ScriptHelper; import io.xpipe.core.process.ProcessOutputException; @@ -28,7 +28,7 @@ public abstract class AppShellChecker { && canFallback && (shouldAttemptFallbackForProcessStartFail() || !err.get().isProcessSpawnIssue())) { var msg = formatMessage(err.get().getMessage()); - ErrorEvent.fromThrowable(new IllegalStateException(msg)).expected().handle(); + ErrorEventFactory.fromThrowable(new IllegalStateException(msg)).expected().handle(); toggleFallback(); var fallbackErr = selfTestErrorCheck(); if (fallbackErr.isPresent()) { @@ -40,7 +40,7 @@ public abstract class AppShellChecker { if (err.isPresent()) { var msg = formatMessage(err.get().getMessage()); - var event = ErrorEvent.fromThrowable(new IllegalStateException(msg)); + var event = ErrorEventFactory.fromThrowable(new IllegalStateException(msg)); if (!err.get().isCanContinue()) { event.term(); } diff --git a/app/src/main/java/io/xpipe/app/core/check/AppTempCheck.java b/app/src/main/java/io/xpipe/app/core/check/AppTempCheck.java index fc8c2bb32..aa1094274 100644 --- a/app/src/main/java/io/xpipe/app/core/check/AppTempCheck.java +++ b/app/src/main/java/io/xpipe/app/core/check/AppTempCheck.java @@ -1,6 +1,6 @@ package io.xpipe.app.core.check; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.core.process.OsType; import java.io.IOException; @@ -20,7 +20,7 @@ public class AppTempCheck { } if (dir == null || !Files.exists(dir) || !Files.isDirectory(dir)) { - ErrorEvent.fromThrowable(new IOException("Specified temporary directory " + tmpdir + ErrorEventFactory.fromThrowable(new IOException("Specified temporary directory " + tmpdir + ", set via the environment variable %TEMP% is invalid.")) .term() .expected() diff --git a/app/src/main/java/io/xpipe/app/core/check/AppUserDirectoryCheck.java b/app/src/main/java/io/xpipe/app/core/check/AppUserDirectoryCheck.java index ef367361a..b7c9297e4 100644 --- a/app/src/main/java/io/xpipe/app/core/check/AppUserDirectoryCheck.java +++ b/app/src/main/java/io/xpipe/app/core/check/AppUserDirectoryCheck.java @@ -1,7 +1,6 @@ package io.xpipe.app.core.check; -import io.xpipe.app.issue.ErrorEvent; - +import io.xpipe.app.issue.ErrorEventFactory; import org.apache.commons.io.FileUtils; import java.io.IOException; @@ -21,7 +20,7 @@ public class AppUserDirectoryCheck { Files.delete(testDirectory); // if (true) throw new IOException(); } catch (IOException e) { - ErrorEvent.fromThrowable( + ErrorEventFactory.fromThrowable( "Unable to access directory " + dataDirectory + ". Please make sure that you have the appropriate permissions and no Antivirus program is blocking the access. " + "In case you use cloud storage, verify that your cloud storage is working and you are logged in.", diff --git a/app/src/main/java/io/xpipe/app/core/mode/OperationMode.java b/app/src/main/java/io/xpipe/app/core/mode/OperationMode.java index 0e29d1f05..830c68db6 100644 --- a/app/src/main/java/io/xpipe/app/core/mode/OperationMode.java +++ b/app/src/main/java/io/xpipe/app/core/mode/OperationMode.java @@ -105,7 +105,7 @@ public abstract class OperationMode { OperationMode.halt(1); } - ErrorEvent.fromThrowable(ex).unhandled(true).build().handle(); + ErrorEventFactory.fromThrowable(ex).unhandled(true).build().handle(); }); TrackEvent.info("Initial setup"); @@ -132,7 +132,7 @@ public abstract class OperationMode { }); TrackEvent.info("Finished initial setup"); } catch (Throwable ex) { - ErrorEvent.fromThrowable(ex).term().handle(); + ErrorEventFactory.fromThrowable(ex).term().handle(); } } @@ -279,7 +279,7 @@ public abstract class OperationMode { LocalShell.init(); r.run(); } catch (Throwable ex) { - ErrorEvent.fromThrowable(ex).handle(); + ErrorEventFactory.fromThrowable(ex).handle(); OperationMode.halt(1); } @@ -340,7 +340,7 @@ public abstract class OperationMode { } CURRENT = null; } catch (Throwable t) { - ErrorEvent.fromThrowable(t).term().handle(); + ErrorEventFactory.fromThrowable(t).term().handle(); OperationMode.halt(1); } @@ -391,7 +391,7 @@ public abstract class OperationMode { } CURRENT = newMode; } catch (Throwable ex) { - ErrorEvent.fromThrowable(ex).terminal(true).build().handle(); + ErrorEventFactory.fromThrowable(ex).terminal(true).build().handle(); } } diff --git a/app/src/main/java/io/xpipe/app/core/window/AppMainWindow.java b/app/src/main/java/io/xpipe/app/core/window/AppMainWindow.java index 18c24149b..ddd29060d 100644 --- a/app/src/main/java/io/xpipe/app/core/window/AppMainWindow.java +++ b/app/src/main/java/io/xpipe/app/core/window/AppMainWindow.java @@ -5,7 +5,7 @@ import io.xpipe.app.comp.base.AppMainWindowContentComp; import io.xpipe.app.core.*; import io.xpipe.app.core.AppImages; import io.xpipe.app.core.mode.OperationMode; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.issue.TrackEvent; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.prefs.CloseBehaviourDialog; @@ -152,7 +152,7 @@ public class AppMainWindow { TrackEvent.info("Window content node structure created"); loadedContent.setValue(s); } catch (Throwable t) { - ErrorEvent.fromThrowable(t).term().handle(); + ErrorEventFactory.fromThrowable(t).term().handle(); } }); } @@ -364,7 +364,7 @@ public class AppMainWindow { try { ImageIO.write(awt, "png", file.toFile()); } catch (IOException e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); } TrackEvent.debug("Screenshot taken"); event.consume(); diff --git a/app/src/main/java/io/xpipe/app/core/window/ModifiedStage.java b/app/src/main/java/io/xpipe/app/core/window/ModifiedStage.java index 22f2e1f41..6f7d188a0 100644 --- a/app/src/main/java/io/xpipe/app/core/window/ModifiedStage.java +++ b/app/src/main/java/io/xpipe/app/core/window/ModifiedStage.java @@ -1,6 +1,6 @@ package io.xpipe.app.core.window; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.util.PlatformThread; import io.xpipe.core.process.OsType; @@ -18,8 +18,6 @@ import javafx.util.Duration; import lombok.SneakyThrows; import org.apache.commons.lang3.SystemUtils; -import java.awt.*; - public class ModifiedStage extends Stage { public static boolean mergeFrame() { @@ -123,7 +121,7 @@ public class ModifiedStage extends Stage { } } } catch (Throwable t) { - ErrorEvent.fromThrowable(t).omit().handle(); + ErrorEventFactory.fromThrowable(t).omit().handle(); } } diff --git a/app/src/main/java/io/xpipe/app/core/window/NativeMacOsWindowControl.java b/app/src/main/java/io/xpipe/app/core/window/NativeMacOsWindowControl.java index 57ac4e059..6937d5dcb 100644 --- a/app/src/main/java/io/xpipe/app/core/window/NativeMacOsWindowControl.java +++ b/app/src/main/java/io/xpipe/app/core/window/NativeMacOsWindowControl.java @@ -1,7 +1,7 @@ package io.xpipe.app.core.window; import io.xpipe.app.core.AppProperties; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.util.NativeBridge; import javafx.stage.Window; @@ -44,7 +44,7 @@ public class NativeMacOsWindowControl { try { lib.get().setAppearance(new NativeLong(nsWindow), seamlessFrame, darkMode); } catch (Throwable e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); } return true; } diff --git a/app/src/main/java/io/xpipe/app/ext/ConnectionFileSystem.java b/app/src/main/java/io/xpipe/app/ext/ConnectionFileSystem.java index 33c8985ee..a891a9bb9 100644 --- a/app/src/main/java/io/xpipe/app/ext/ConnectionFileSystem.java +++ b/app/src/main/java/io/xpipe/app/ext/ConnectionFileSystem.java @@ -1,6 +1,6 @@ package io.xpipe.app.ext; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.util.DocumentationLink; import io.xpipe.core.process.CommandBuilder; import io.xpipe.core.process.ShellControl; @@ -84,7 +84,7 @@ public class ConnectionFileSystem implements FileSystem { try { d.throwIfUnsupported(); } catch (Exception e) { - throw ErrorEvent.expected(e); + throw ErrorEventFactory.expected(e); } } @@ -92,7 +92,7 @@ public class ConnectionFileSystem implements FileSystem { || !shellControl.getTtyState().isSupportsInput()) { var ex = new UnsupportedOperationException( "Shell has a PTY allocated and as a result does not support file system operations."); - ErrorEvent.preconfigure(ErrorEvent.fromThrowable(ex).documentationLink(DocumentationLink.TTY)); + ErrorEventFactory.preconfigure(ErrorEventFactory.fromThrowable(ex).documentationLink(DocumentationLink.TTY)); throw ex; } @@ -240,7 +240,7 @@ public class ConnectionFileSystem implements FileSystem { try { shellControl.close(); } catch (Exception ex) { - ErrorEvent.fromThrowable(ex).omit().expected().handle(); + ErrorEventFactory.fromThrowable(ex).omit().expected().handle(); } } } diff --git a/app/src/main/java/io/xpipe/app/ext/DataStoreProviders.java b/app/src/main/java/io/xpipe/app/ext/DataStoreProviders.java index f66b6a896..8d2f9057a 100644 --- a/app/src/main/java/io/xpipe/app/ext/DataStoreProviders.java +++ b/app/src/main/java/io/xpipe/app/ext/DataStoreProviders.java @@ -1,6 +1,6 @@ package io.xpipe.app.ext; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.issue.TrackEvent; import io.xpipe.core.store.DataStore; import io.xpipe.core.util.JacksonMapper; @@ -22,7 +22,7 @@ public class DataStoreProviders { try { dataStoreProvider.init(); } catch (Exception e) { - ErrorEvent.fromThrowable(e).omit().handle(); + ErrorEventFactory.fromThrowable(e).omit().handle(); } }); } @@ -32,7 +32,7 @@ public class DataStoreProviders { try { dataStoreProvider.reset(); } catch (Exception e) { - ErrorEvent.fromThrowable(e).omit().handle(); + ErrorEventFactory.fromThrowable(e).omit().handle(); } }); } @@ -74,7 +74,7 @@ public class DataStoreProviders { p.validate(); return false; } catch (Throwable e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); return true; } }); diff --git a/app/src/main/java/io/xpipe/app/ext/Session.java b/app/src/main/java/io/xpipe/app/ext/Session.java index b3152d1f0..5c89fe723 100644 --- a/app/src/main/java/io/xpipe/app/ext/Session.java +++ b/app/src/main/java/io/xpipe/app/ext/Session.java @@ -1,6 +1,6 @@ package io.xpipe.app.ext; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.util.GlobalTimer; import io.xpipe.app.util.ThreadHelper; @@ -31,13 +31,13 @@ public abstract class Session implements AutoCloseable { return; } } catch (Exception e) { - ErrorEvent.fromThrowable(e).omit().handle(); + ErrorEventFactory.fromThrowable(e).omit().handle(); } try { stop(); } catch (Exception e) { - ErrorEvent.fromThrowable(e).omit().handle(); + ErrorEventFactory.fromThrowable(e).omit().handle(); } }); return false; diff --git a/app/src/main/java/io/xpipe/app/ext/ShellStore.java b/app/src/main/java/io/xpipe/app/ext/ShellStore.java index f315efbbd..34c09aa2d 100644 --- a/app/src/main/java/io/xpipe/app/ext/ShellStore.java +++ b/app/src/main/java/io/xpipe/app/ext/ShellStore.java @@ -1,6 +1,6 @@ package io.xpipe.app.ext; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.core.process.ShellControl; import io.xpipe.core.process.StubShellControl; import io.xpipe.core.store.*; @@ -23,7 +23,7 @@ public interface ShellStore extends DataStore, FileSystemStore, ValidatableStore existingSession.getShellControl().command(" echo xpipetest").execute(); return new StubShellControl(existingSession.getShellControl()); } catch (Exception e) { - ErrorEvent.fromThrowable(e).expected().omit().handle(); + ErrorEventFactory.fromThrowable(e).expected().omit().handle(); stopSessionIfNeeded(); } } @@ -51,11 +51,11 @@ public interface ShellStore extends DataStore, FileSystemStore, ValidatableStore session.getShellControl().command(" echo xpipetest").execute(); return true; } catch (Exception e) { - ErrorEvent.fromThrowable(e).expected().omit().handle(); + ErrorEventFactory.fromThrowable(e).expected().omit().handle(); try { stopSessionIfNeeded(); } catch (Exception se) { - ErrorEvent.fromThrowable(se).expected().omit().handle(); + ErrorEventFactory.fromThrowable(se).expected().omit().handle(); } return false; } diff --git a/app/src/main/java/io/xpipe/app/hub/comp/StoreCreationDialog.java b/app/src/main/java/io/xpipe/app/hub/comp/StoreCreationDialog.java index c63815e62..45800ddb3 100644 --- a/app/src/main/java/io/xpipe/app/hub/comp/StoreCreationDialog.java +++ b/app/src/main/java/io/xpipe/app/hub/comp/StoreCreationDialog.java @@ -8,7 +8,7 @@ import io.xpipe.app.core.window.AppDialog; import io.xpipe.app.ext.DataStoreCreationCategory; import io.xpipe.app.ext.DataStoreProvider; import io.xpipe.app.ext.DataStoreProviders; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.storage.DataStorage; import io.xpipe.app.storage.DataStoreEntry; @@ -99,7 +99,7 @@ public class StoreCreationDialog { }); } } catch (Exception ex) { - ErrorEvent.fromThrowable(ex).handle(); + ErrorEventFactory.fromThrowable(ex).handle(); } }; show( diff --git a/app/src/main/java/io/xpipe/app/hub/comp/StoreCreationModel.java b/app/src/main/java/io/xpipe/app/hub/comp/StoreCreationModel.java index 392b843ab..abf7c3b57 100644 --- a/app/src/main/java/io/xpipe/app/hub/comp/StoreCreationModel.java +++ b/app/src/main/java/io/xpipe/app/hub/comp/StoreCreationModel.java @@ -3,7 +3,7 @@ package io.xpipe.app.hub.comp; import io.xpipe.app.ext.DataStoreProvider; import io.xpipe.app.ext.ShellStore; import io.xpipe.app.hub.action.impl.LaunchStoreActionProvider; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.storage.DataStorage; import io.xpipe.app.storage.DataStoreCategory; import io.xpipe.app.storage.DataStoreEntry; @@ -200,7 +200,7 @@ public class StoreCreationModel { .getMessages() .getFirst() .getText(); - ErrorEvent.fromMessage(msg).expected().handle(); + ErrorEventFactory.fromMessage(msg).expected().handle(); changedSinceError.setValue(false); return; } @@ -227,15 +227,15 @@ public class StoreCreationModel { commit(true); } catch (Throwable ex) { if (ex instanceof ValidationException) { - ErrorEvent.expected(ex); + ErrorEventFactory.expected(ex); } else if (ex instanceof StackOverflowError) { // Cycles in connection graphs can fail hard but are expected - ErrorEvent.expected(ex); + ErrorEventFactory.expected(ex); } changedSinceError.setValue(false); - ErrorEvent.fromThrowable(ex).handle(); + ErrorEventFactory.fromThrowable(ex).handle(); } finally { DataStorage.get().removeStoreEntryInProgress(entry.getValue()); } diff --git a/app/src/main/java/io/xpipe/app/hub/comp/StoreEntryWrapper.java b/app/src/main/java/io/xpipe/app/hub/comp/StoreEntryWrapper.java index 52a08f72d..b3e52a581 100644 --- a/app/src/main/java/io/xpipe/app/hub/comp/StoreEntryWrapper.java +++ b/app/src/main/java/io/xpipe/app/hub/comp/StoreEntryWrapper.java @@ -8,7 +8,7 @@ import io.xpipe.app.hub.action.BranchStoreActionProvider; import io.xpipe.app.hub.action.LeafStoreActionProvider; import io.xpipe.app.hub.action.StoreActionProvider; import io.xpipe.app.hub.action.impl.EditStoreActionProvider; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.storage.DataStorage; import io.xpipe.app.storage.DataStoreCategory; @@ -222,7 +222,7 @@ public class StoreEntryWrapper { AppPrefs.get().censorMode(), information)); } catch (Exception e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); information.bind(new SimpleStringProperty()); } } @@ -237,7 +237,7 @@ public class StoreEntryWrapper { entry.getProvider() != null ? entry.getProvider().summaryString(this) : null); } catch (Exception ex) { // Summary creation might fail or have a bug - ErrorEvent.fromThrowable(ex).handle(); + ErrorEventFactory.fromThrowable(ex).handle(); } } @@ -288,7 +288,7 @@ public class StoreEntryWrapper { minorActionProviders.setAll(newMinorProviders); } } catch (Exception ex) { - ErrorEvent.fromThrowable(ex).handle(); + ErrorEventFactory.fromThrowable(ex).handle(); } } diff --git a/app/src/main/java/io/xpipe/app/hub/comp/StoreViewState.java b/app/src/main/java/io/xpipe/app/hub/comp/StoreViewState.java index 36e52bcba..c4c3e9707 100644 --- a/app/src/main/java/io/xpipe/app/hub/comp/StoreViewState.java +++ b/app/src/main/java/io/xpipe/app/hub/comp/StoreViewState.java @@ -2,7 +2,7 @@ package io.xpipe.app.hub.comp; import io.xpipe.app.core.AppCache; import io.xpipe.app.ext.DataStoreUsageCategory; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.storage.DataStorage; import io.xpipe.app.storage.DataStoreCategory; @@ -161,7 +161,7 @@ public class StoreViewState { } catch (Exception exception) { currentTopLevelSection = new StoreSection( null, DerivedObservableList.arrayList(true), DerivedObservableList.arrayList(true), 0); - ErrorEvent.fromThrowable(exception).handle(); + ErrorEventFactory.fromThrowable(exception).handle(); } } diff --git a/app/src/main/java/io/xpipe/app/icon/SystemIconCache.java b/app/src/main/java/io/xpipe/app/icon/SystemIconCache.java index d92beb84b..785ea30bf 100644 --- a/app/src/main/java/io/xpipe/app/icon/SystemIconCache.java +++ b/app/src/main/java/io/xpipe/app/icon/SystemIconCache.java @@ -1,7 +1,7 @@ package io.xpipe.app.icon; import io.xpipe.app.core.AppProperties; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.issue.TrackEvent; import com.github.weisj.jsvg.SVGDocument; @@ -91,7 +91,7 @@ public class SystemIconCache { if (scheme == ImageColorScheme.TRANSPARENT) { var message = "Failed to rasterize icon " + icon.getFile().getFileName().toString() + ": Rasterized image is transparent"; - ErrorEvent.fromMessage(message).omit().expected().handle(); + ErrorEventFactory.fromMessage(message).omit().expected().handle(); continue; } @@ -118,7 +118,7 @@ public class SystemIconCache { if (scheme == ImageColorScheme.TRANSPARENT) { var message = "Failed to rasterize icon " + icon.getFile().getFileName().toString() + ": Rasterized image is transparent"; - ErrorEvent.fromMessage(message).omit().expected().handle(); + ErrorEventFactory.fromMessage(message).omit().expected().handle(); } continue; @@ -136,7 +136,7 @@ public class SystemIconCache { } } } catch (Exception e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); } } @@ -175,7 +175,7 @@ public class SystemIconCache { return c != null ? c : ImageColorScheme.TRANSPARENT; } catch (Exception ex) { var message = "Failed to rasterize icon icon " + path.getFileName().toString() + ": " + ex.getMessage(); - ErrorEvent.fromThrowable(ex).description(message).omit().expected().handle(); + ErrorEventFactory.fromThrowable(ex).description(message).omit().expected().handle(); return ImageColorScheme.TRANSPARENT; } } @@ -196,7 +196,7 @@ public class SystemIconCache { throw ex; } - ErrorEvent.fromThrowable(ex).omit().expected().handle(); + ErrorEventFactory.fromThrowable(ex).omit().expected().handle(); } } diff --git a/app/src/main/java/io/xpipe/app/icon/SystemIconManager.java b/app/src/main/java/io/xpipe/app/icon/SystemIconManager.java index d472b7705..c443ce4f4 100644 --- a/app/src/main/java/io/xpipe/app/icon/SystemIconManager.java +++ b/app/src/main/java/io/xpipe/app/icon/SystemIconManager.java @@ -3,7 +3,7 @@ package io.xpipe.app.icon; import io.xpipe.app.core.AppCache; import io.xpipe.app.core.AppImages; import io.xpipe.app.core.AppProperties; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.prefs.SupportedLocale; import io.xpipe.app.storage.DataStorage; @@ -41,7 +41,7 @@ public class SystemIconManager { try { pref.checkComplete(); } catch (ValidationException e) { - ErrorEvent.fromThrowable(e).omit().expected().handle(); + ErrorEventFactory.fromThrowable(e).omit().expected().handle(); continue; } @@ -101,7 +101,7 @@ public class SystemIconManager { AppImages.loadRasterImages(SystemIconCache.getDirectory(source), "icons/" + source.getId()); } } catch (Exception e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); } } @@ -111,7 +111,7 @@ public class SystemIconManager { try { source.refresh(); } catch (Exception e) { - ErrorEvent.fromThrowable(e).expected().handle(); + ErrorEventFactory.fromThrowable(e).expected().handle(); } } reloadSources(); diff --git a/app/src/main/java/io/xpipe/app/icon/SystemIconSource.java b/app/src/main/java/io/xpipe/app/icon/SystemIconSource.java index 8b79bf121..7a680093a 100644 --- a/app/src/main/java/io/xpipe/app/icon/SystemIconSource.java +++ b/app/src/main/java/io/xpipe/app/icon/SystemIconSource.java @@ -1,7 +1,7 @@ package io.xpipe.app.icon; import io.xpipe.app.ext.ProcessControlProvider; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.util.DesktopHelper; import io.xpipe.app.util.Hyperlinks; import io.xpipe.app.util.Validators; @@ -97,7 +97,7 @@ public interface SystemIconSource { if (!present) { var msg = "Git command-line tools are not available in the PATH but are required to use icons from a git repository. For more details, see https://git-scm.com/downloads."; - ErrorEvent.fromMessage(msg).expected().handle(); + ErrorEventFactory.fromMessage(msg).expected().handle(); return; } diff --git a/app/src/main/java/io/xpipe/app/icon/SystemIconSourceData.java b/app/src/main/java/io/xpipe/app/icon/SystemIconSourceData.java index cb8fa0326..b83ff5392 100644 --- a/app/src/main/java/io/xpipe/app/icon/SystemIconSourceData.java +++ b/app/src/main/java/io/xpipe/app/icon/SystemIconSourceData.java @@ -1,7 +1,6 @@ package io.xpipe.app.icon; -import io.xpipe.app.issue.ErrorEvent; - +import io.xpipe.app.issue.ErrorEventFactory; import lombok.Value; import org.apache.commons.io.FilenameUtils; @@ -64,7 +63,7 @@ public class SystemIconSourceData { } } } catch (Exception e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); } } } diff --git a/app/src/main/java/io/xpipe/app/issue/ErrorEvent.java b/app/src/main/java/io/xpipe/app/issue/ErrorEvent.java index cb81e6d0a..81f5cf907 100644 --- a/app/src/main/java/io/xpipe/app/issue/ErrorEvent.java +++ b/app/src/main/java/io/xpipe/app/issue/ErrorEvent.java @@ -9,14 +9,12 @@ import lombok.Singular; import java.nio.file.Path; import java.util.*; -import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CopyOnWriteArraySet; @Builder @Getter public class ErrorEvent { - private static final Map EVENT_BASES = new ConcurrentHashMap<>(); private static final Set HANDLED = new CopyOnWriteArraySet<>(); @Builder.Default @@ -45,63 +43,6 @@ public class ErrorEvent { private String userReport; private boolean unhandled; - public static ErrorEventBuilder fromThrowable(Throwable t) { - if (EVENT_BASES.containsKey(t)) { - return EVENT_BASES.remove(t).description(t.getMessage()); - } - - return builder().throwable(t).description(t.getMessage()); - } - - public static ErrorEventBuilder fromThrowable(String msg, Throwable t) { - if (EVENT_BASES.containsKey(t)) { - return EVENT_BASES.remove(t).description(msg); - } - - return builder() - .throwable(t) - .description( - msg + (t.getMessage() != null ? "\n\n" + t.getMessage().strip() : "")); - } - - public static ErrorEventBuilder fromMessage(String msg) { - return builder().description(msg); - } - - public static T expectedIfEndsWith(T t, String... s) { - return expectedIf( - t, - t.getMessage() != null - && Arrays.stream(s).map(String::toLowerCase).anyMatch(string -> t.getMessage() - .toLowerCase(Locale.ROOT) - .endsWith(string))); - } - - public static T expectedIfContains(T t, String... s) { - return expectedIf( - t, - t.getMessage() != null - && Arrays.stream(s).map(String::toLowerCase).anyMatch(string -> t.getMessage() - .toLowerCase(Locale.ROOT) - .contains(string))); - } - - public static T expectedIf(T t, boolean b) { - if (b) { - EVENT_BASES.put(t, ErrorEvent.fromThrowable(t).expected()); - } - return t; - } - - public static T expected(T t) { - EVENT_BASES.put(t, ErrorEvent.fromThrowable(t).expected()); - return t; - } - - public static void preconfigure(ErrorEventBuilder event) { - EVENT_BASES.put(event.throwable, event); - } - public void attachUserReport(String email, String text) { this.email = email; userReport = text; @@ -181,5 +122,13 @@ public class ErrorEvent { expected(); } } + + Throwable getThrowable() { + return throwable; + } + + String getLink() { + return link; + } } } diff --git a/app/src/main/java/io/xpipe/app/issue/ErrorEventFactory.java b/app/src/main/java/io/xpipe/app/issue/ErrorEventFactory.java new file mode 100644 index 000000000..5f270cb1e --- /dev/null +++ b/app/src/main/java/io/xpipe/app/issue/ErrorEventFactory.java @@ -0,0 +1,73 @@ +package io.xpipe.app.issue; + +import io.xpipe.app.util.DocumentationLink; +import io.xpipe.core.process.OsType; +import io.xpipe.core.process.ProcessOutputException; + +import javax.net.ssl.SSLHandshakeException; +import java.util.Arrays; +import java.util.IdentityHashMap; +import java.util.Locale; +import java.util.Map; + +public class ErrorEventFactory { + + private static final Map EVENT_BASES = new IdentityHashMap<>(); + + public static ErrorEvent.ErrorEventBuilder fromThrowable(Throwable t) { + var b = retrieveBuilder(t); + return b.description(t.getMessage()); + } + + public static ErrorEvent.ErrorEventBuilder fromThrowable(String msg, Throwable t) { + var b = retrieveBuilder(t); + return b.description(msg + (t.getMessage() != null ? "\n\n" + t.getMessage().strip() : "")); + } + + public static ErrorEvent.ErrorEventBuilder fromMessage(String msg) { + return ErrorEvent.builder().description(msg); + } + + public static T expectedIfContains(T t, String... s) { + return expectedIf( + t, + t.getMessage() != null + && Arrays.stream(s).map(String::toLowerCase).anyMatch(string -> t.getMessage() + .toLowerCase(Locale.ROOT) + .contains(string))); + } + + public static T expectedIf(T t, boolean b) { + if (b) { + preconfigure(fromThrowable(t).expected()); + } + return t; + } + + public static T expected(T t) { + preconfigure(fromThrowable(t).expected()); + return t; + } + + public static synchronized void preconfigure(ErrorEvent.ErrorEventBuilder event) { + EVENT_BASES.put(event.getThrowable(), event); + } + + private static synchronized ErrorEvent.ErrorEventBuilder retrieveBuilder(Throwable t) { + var b = EVENT_BASES.remove(t); + if (b == null) { + b = ErrorEvent.builder().throwable(t); + } + + if (t instanceof SSLHandshakeException && b.getLink() == null) { + b.documentationLink(DocumentationLink.TLS_DECRYPTION); + } + + // Indicates that the session is scheduled to end and new processes won't be started + if (OsType.getLocal() == OsType.WINDOWS && t instanceof ProcessOutputException pex && pex.getExitCode() == -1073741205) { + b.expected(); + } + + return b; + } +} diff --git a/app/src/main/java/io/xpipe/app/issue/ErrorHandlerDialog.java b/app/src/main/java/io/xpipe/app/issue/ErrorHandlerDialog.java index 67b179ec1..9bbf24a78 100644 --- a/app/src/main/java/io/xpipe/app/issue/ErrorHandlerDialog.java +++ b/app/src/main/java/io/xpipe/app/issue/ErrorHandlerDialog.java @@ -72,7 +72,7 @@ public class ErrorHandlerDialog { comp.getTakenAction().setValue(ErrorAction.ignore()); } } catch (Throwable t) { - ErrorAction.ignore().handle(ErrorEvent.fromThrowable(t).build()); + ErrorAction.ignore().handle(ErrorEventFactory.fromThrowable(t).build()); ErrorAction.ignore().handle(event); } } diff --git a/app/src/main/java/io/xpipe/app/issue/GuiErrorHandler.java b/app/src/main/java/io/xpipe/app/issue/GuiErrorHandler.java index 667488be9..896d0db92 100644 --- a/app/src/main/java/io/xpipe/app/issue/GuiErrorHandler.java +++ b/app/src/main/java/io/xpipe/app/issue/GuiErrorHandler.java @@ -19,7 +19,7 @@ public class GuiErrorHandler extends GuiErrorHandlerBase implements ErrorHandler log.handle(event); if (!startupGui(throwable -> { - var second = ErrorEvent.fromThrowable(throwable).build(); + var second = ErrorEventFactory.fromThrowable(throwable).build(); log.handle(second); ErrorAction.ignore().handle(second); })) { diff --git a/app/src/main/java/io/xpipe/app/issue/TerminalErrorHandler.java b/app/src/main/java/io/xpipe/app/issue/TerminalErrorHandler.java index 4bf49f286..013b2ecfb 100644 --- a/app/src/main/java/io/xpipe/app/issue/TerminalErrorHandler.java +++ b/app/src/main/java/io/xpipe/app/issue/TerminalErrorHandler.java @@ -63,7 +63,7 @@ public class TerminalErrorHandler extends GuiErrorHandlerBase implements ErrorHa private void handleWithSecondaryException(ErrorEvent event, Throwable t) { ErrorAction.ignore().handle(event); - var second = ErrorEvent.fromThrowable(t).build(); + var second = ErrorEventFactory.fromThrowable(t).build(); log.handle(second); ErrorAction.ignore().handle(second); ThreadHelper.sleep(1000); @@ -87,7 +87,7 @@ public class TerminalErrorHandler extends GuiErrorHandlerBase implements ErrorHa AppDialog.showAndWait(updateModal); } } catch (Throwable t) { - var event = ErrorEvent.fromThrowable(t).build(); + var event = ErrorEventFactory.fromThrowable(t).build(); log.handle(event); ErrorAction.ignore().handle(event); ThreadHelper.sleep(1000); diff --git a/app/src/main/java/io/xpipe/app/prefs/AppPrefsStorageHandler.java b/app/src/main/java/io/xpipe/app/prefs/AppPrefsStorageHandler.java index cdbcccb9a..ee954f911 100644 --- a/app/src/main/java/io/xpipe/app/prefs/AppPrefsStorageHandler.java +++ b/app/src/main/java/io/xpipe/app/prefs/AppPrefsStorageHandler.java @@ -1,7 +1,7 @@ package io.xpipe.app.prefs; import io.xpipe.app.ext.PrefsChoiceValue; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.issue.TrackEvent; import io.xpipe.core.util.JacksonMapper; @@ -51,7 +51,7 @@ public class AppPrefsStorageHandler { var read = o.readTree(Files.readAllBytes(file)); content = read.isObject() ? (ObjectNode) read : null; } catch (IOException e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); } } @@ -152,7 +152,7 @@ public class AppPrefsStorageHandler { } return value; } catch (Exception ex) { - ErrorEvent.fromThrowable(ex).expected().omit().handle(); + ErrorEventFactory.fromThrowable(ex).expected().omit().handle(); return defaultObject; } } diff --git a/app/src/main/java/io/xpipe/app/prefs/ExternalApplicationType.java b/app/src/main/java/io/xpipe/app/prefs/ExternalApplicationType.java index db72b759f..b6117f4f0 100644 --- a/app/src/main/java/io/xpipe/app/prefs/ExternalApplicationType.java +++ b/app/src/main/java/io/xpipe/app/prefs/ExternalApplicationType.java @@ -1,7 +1,7 @@ package io.xpipe.app.prefs; import io.xpipe.app.ext.PrefsValue; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.util.CommandSupport; import io.xpipe.app.util.LocalShell; import io.xpipe.app.util.Translatable; @@ -35,7 +35,7 @@ public interface ExternalApplicationType extends PrefsValue { try { return findApp().isPresent(); } catch (Exception e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); return false; } } @@ -74,7 +74,7 @@ public interface ExternalApplicationType extends PrefsValue { pc.command(String.format("open -a \"%s.app\"", getApplicationName())) .execute(); } catch (Exception e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); } } @@ -94,7 +94,7 @@ public interface ExternalApplicationType extends PrefsValue { try (ShellControl pc = LocalShell.getShell()) { return CommandSupport.findProgram(pc, getExecutable()).isPresent(); } catch (Exception e) { - ErrorEvent.fromThrowable(e).omit().handle(); + ErrorEventFactory.fromThrowable(e).omit().handle(); return false; } } @@ -102,7 +102,7 @@ public interface ExternalApplicationType extends PrefsValue { default void launch(CommandBuilder args) throws Exception { try (ShellControl pc = LocalShell.getShell()) { if (!CommandSupport.isInPath(pc, getExecutable())) { - throw ErrorEvent.expected( + throw ErrorEventFactory.expected( new IOException( "Executable " + getExecutable() + " not found in PATH. Either add it to the PATH and refresh the environment by restarting XPipe, or specify an absolute executable path using the custom terminal setting.")); @@ -132,7 +132,7 @@ public interface ExternalApplicationType extends PrefsValue { return out.map(filePath -> Path.of(filePath.toString())); } } catch (Exception ex) { - ErrorEvent.fromThrowable(ex).omit().handle(); + ErrorEventFactory.fromThrowable(ex).omit().handle(); } return Optional.empty(); } @@ -145,7 +145,7 @@ public interface ExternalApplicationType extends PrefsValue { var name = this instanceof Translatable t ? t.toTranslatedString().getValue() : getExecutable(); - throw ErrorEvent.expected( + throw ErrorEventFactory.expected( new UnsupportedOperationException("Unable to find installation of " + name)); } } diff --git a/app/src/main/java/io/xpipe/app/prefs/ExternalEditorType.java b/app/src/main/java/io/xpipe/app/prefs/ExternalEditorType.java index 69a3a8819..ba9dd7b94 100644 --- a/app/src/main/java/io/xpipe/app/prefs/ExternalEditorType.java +++ b/app/src/main/java/io/xpipe/app/prefs/ExternalEditorType.java @@ -1,7 +1,7 @@ package io.xpipe.app.prefs; import io.xpipe.app.ext.PrefsChoiceValue; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.terminal.TerminalLauncher; import io.xpipe.app.util.LocalShell; import io.xpipe.app.util.WindowsRegistry; @@ -355,7 +355,7 @@ public interface ExternalEditorType extends PrefsChoiceValue { public void launch(Path file) throws Exception { var customCommand = AppPrefs.get().customEditorCommand().getValue(); if (customCommand == null || customCommand.isBlank()) { - throw ErrorEvent.expected(new IllegalStateException("No custom editor command specified")); + throw ErrorEventFactory.expected(new IllegalStateException("No custom editor command specified")); } var format = diff --git a/app/src/main/java/io/xpipe/app/prefs/IconsCategory.java b/app/src/main/java/io/xpipe/app/prefs/IconsCategory.java index b36fbfd1d..1d49cc4cd 100644 --- a/app/src/main/java/io/xpipe/app/prefs/IconsCategory.java +++ b/app/src/main/java/io/xpipe/app/prefs/IconsCategory.java @@ -7,7 +7,7 @@ import io.xpipe.app.core.AppFontSizes; import io.xpipe.app.core.window.AppDialog; import io.xpipe.app.icon.SystemIconManager; import io.xpipe.app.icon.SystemIconSource; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.storage.DataStorage; import io.xpipe.app.util.*; import io.xpipe.core.store.FilePath; @@ -120,7 +120,7 @@ public class IconsCategory extends AppPrefsCategory { var path = dir.get().asLocalPath(); if (Files.isRegularFile(path)) { - throw ErrorEvent.expected( + throw ErrorEventFactory.expected( new IllegalArgumentException( "A custom icon source must be a directory containing .svg files, not a single file")); } diff --git a/app/src/main/java/io/xpipe/app/prefs/LoggingCategory.java b/app/src/main/java/io/xpipe/app/prefs/LoggingCategory.java index 34ba3bf86..33f12da94 100644 --- a/app/src/main/java/io/xpipe/app/prefs/LoggingCategory.java +++ b/app/src/main/java/io/xpipe/app/prefs/LoggingCategory.java @@ -4,7 +4,7 @@ import io.xpipe.app.comp.Comp; import io.xpipe.app.comp.base.*; import io.xpipe.app.core.AppI18n; import io.xpipe.app.core.AppProperties; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.util.*; import java.io.IOException; @@ -32,7 +32,7 @@ public class LoggingCategory extends AppPrefsCategory { Files.createDirectories(dir); DesktopHelper.browsePathLocal(dir); } catch (IOException e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); } }) .disable(prefs.enableTerminalLogging.not()))) diff --git a/app/src/main/java/io/xpipe/app/prefs/TerminalCategory.java b/app/src/main/java/io/xpipe/app/prefs/TerminalCategory.java index 2081ed7ab..9bc7c7a5f 100644 --- a/app/src/main/java/io/xpipe/app/prefs/TerminalCategory.java +++ b/app/src/main/java/io/xpipe/app/prefs/TerminalCategory.java @@ -8,7 +8,7 @@ import io.xpipe.app.ext.ProcessControlProvider; import io.xpipe.app.ext.ShellStore; import io.xpipe.app.hub.comp.StoreChoiceComp; import io.xpipe.app.hub.comp.StoreViewState; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.storage.DataStorage; import io.xpipe.app.storage.DataStoreEntryRef; import io.xpipe.app.terminal.*; @@ -51,7 +51,7 @@ public class TerminalCategory extends AppPrefsCategory { }); feature.throwIfUnsupported(); } catch (LicenseRequiredException ex) { - ErrorEvent.fromThrowable(ex).handle(); + ErrorEventFactory.fromThrowable(ex).handle(); } } }); diff --git a/app/src/main/java/io/xpipe/app/prefs/TroubleshootCategory.java b/app/src/main/java/io/xpipe/app/prefs/TroubleshootCategory.java index 01b5ccf76..49c083bf8 100644 --- a/app/src/main/java/io/xpipe/app/prefs/TroubleshootCategory.java +++ b/app/src/main/java/io/xpipe/app/prefs/TroubleshootCategory.java @@ -8,7 +8,7 @@ import io.xpipe.app.core.AppLogs; import io.xpipe.app.core.AppProperties; import io.xpipe.app.core.mode.OperationMode; import io.xpipe.app.core.window.AppDialog; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.issue.UserReportComp; import io.xpipe.app.terminal.TerminalLauncher; import io.xpipe.app.util.DesktopHelper; @@ -44,7 +44,7 @@ public class TroubleshootCategory extends AppPrefsCategory { .spacer(19) .addComp( new TileButtonComp("reportIssue", "reportIssueDescription", "mdal-bug_report", e -> { - var event = ErrorEvent.fromMessage("User Report"); + var event = ErrorEventFactory.fromMessage("User Report"); if (AppLogs.get().isWriteToFile()) { event.attachment(AppLogs.get().getSessionLogsDirectory()); } diff --git a/app/src/main/java/io/xpipe/app/prefs/WorkspaceCreationDialog.java b/app/src/main/java/io/xpipe/app/prefs/WorkspaceCreationDialog.java index 5f35a8eca..3afebe392 100644 --- a/app/src/main/java/io/xpipe/app/prefs/WorkspaceCreationDialog.java +++ b/app/src/main/java/io/xpipe/app/prefs/WorkspaceCreationDialog.java @@ -5,7 +5,7 @@ import io.xpipe.app.comp.base.ModalOverlay; import io.xpipe.app.core.AppFontSizes; import io.xpipe.app.core.AppProperties; import io.xpipe.app.core.mode.OperationMode; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.util.*; import io.xpipe.core.process.OsType; import io.xpipe.core.util.XPipeInstallation; @@ -63,7 +63,7 @@ public class WorkspaceCreationDialog { DesktopHelper.browseFileInDirectory(file); OperationMode.close(); } catch (Exception e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); } })); modal.show(); diff --git a/app/src/main/java/io/xpipe/app/pwman/BitwardenPasswordManager.java b/app/src/main/java/io/xpipe/app/pwman/BitwardenPasswordManager.java index 24f98bb89..1981a1ae1 100644 --- a/app/src/main/java/io/xpipe/app/pwman/BitwardenPasswordManager.java +++ b/app/src/main/java/io/xpipe/app/pwman/BitwardenPasswordManager.java @@ -1,7 +1,7 @@ package io.xpipe.app.pwman; import io.xpipe.app.ext.ProcessControlProvider; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.terminal.TerminalLauncher; import io.xpipe.app.util.*; import io.xpipe.core.process.CommandBuilder; @@ -30,7 +30,7 @@ public class BitwardenPasswordManager implements PasswordManager { try { CommandSupport.isInLocalPathOrThrow("Bitwarden CLI", "bw"); } catch (Exception e) { - ErrorEvent.fromThrowable(e) + ErrorEventFactory.fromThrowable(e) .link("https://bitwarden.com/help/cli/#download-and-install") .handle(); return null; @@ -70,7 +70,7 @@ public class BitwardenPasswordManager implements PasswordManager { var password = login.required("password"); return new CredentialResult(user.isNull() ? null : user.asText(), InPlaceSecretValue.of(password.asText())); } catch (Exception ex) { - ErrorEvent.fromThrowable(ex).handle(); + ErrorEventFactory.fromThrowable(ex).handle(); return null; } } diff --git a/app/src/main/java/io/xpipe/app/pwman/DashlanePasswordManager.java b/app/src/main/java/io/xpipe/app/pwman/DashlanePasswordManager.java index 1aa6fcb2b..84f0c0600 100644 --- a/app/src/main/java/io/xpipe/app/pwman/DashlanePasswordManager.java +++ b/app/src/main/java/io/xpipe/app/pwman/DashlanePasswordManager.java @@ -1,7 +1,7 @@ package io.xpipe.app.pwman; import io.xpipe.app.ext.ProcessControlProvider; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.terminal.TerminalLauncher; import io.xpipe.app.util.CommandSupport; import io.xpipe.core.process.CommandBuilder; @@ -30,7 +30,7 @@ public class DashlanePasswordManager implements PasswordManager { try { CommandSupport.isInLocalPathOrThrow("Dashlane CLI", "dcli"); } catch (Exception e) { - ErrorEvent.fromThrowable(e).link("https://cli.dashlane.com/install").handle(); + ErrorEventFactory.fromThrowable(e).link("https://cli.dashlane.com/install").handle(); return null; } @@ -57,7 +57,7 @@ public class DashlanePasswordManager implements PasswordManager { login != null ? login.asText() : null, password != null ? InPlaceSecretValue.of(password.asText()) : null); } catch (Exception ex) { - ErrorEvent.fromThrowable(ex).handle(); + ErrorEventFactory.fromThrowable(ex).handle(); return null; } } diff --git a/app/src/main/java/io/xpipe/app/pwman/EnpassPasswordManager.java b/app/src/main/java/io/xpipe/app/pwman/EnpassPasswordManager.java index 6106f5206..05129fb7a 100644 --- a/app/src/main/java/io/xpipe/app/pwman/EnpassPasswordManager.java +++ b/app/src/main/java/io/xpipe/app/pwman/EnpassPasswordManager.java @@ -2,7 +2,7 @@ package io.xpipe.app.pwman; import io.xpipe.app.comp.base.ContextualFileReferenceChoiceComp; import io.xpipe.app.ext.ProcessControlProvider; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.storage.DataStorage; import io.xpipe.app.util.*; import io.xpipe.core.process.CommandBuilder; @@ -82,19 +82,19 @@ public class EnpassPasswordManager implements PasswordManager { try { CommandSupport.isInLocalPathOrThrow("Enpass CLI", "enpass-cli"); } catch (Exception e) { - ErrorEvent.fromThrowable(e) + ErrorEventFactory.fromThrowable(e) .link("https://github.com/hazcod/enpass-cli") .handle(); return null; } if (vaultPath == null) { - throw ErrorEvent.expected(new IllegalArgumentException("No vault path has been set")); + throw ErrorEventFactory.expected(new IllegalArgumentException("No vault path has been set")); } var vaultDir = vaultPath.asLocalPath(); if (!Files.exists(vaultDir)) { - throw ErrorEvent.expected(new IllegalArgumentException("Vault path " + vaultPath + " does not exist")); + throw ErrorEventFactory.expected(new IllegalArgumentException("Vault path " + vaultPath + " does not exist")); } if (Files.isRegularFile(vaultDir)) { vaultDir = vaultDir.getParent(); @@ -133,7 +133,7 @@ public class EnpassPasswordManager implements PasswordManager { } if (json.size() == 0) { - throw ErrorEvent.expected( + throw ErrorEventFactory.expected( new IllegalArgumentException("No items were found matching the title " + key)); } @@ -145,7 +145,7 @@ public class EnpassPasswordManager implements PasswordManager { matches.add(title.asText()); } }); - throw ErrorEvent.expected(new IllegalArgumentException( + throw ErrorEventFactory.expected(new IllegalArgumentException( "Ambiguous item name, multiple password entries match: " + String.join(", ", matches))); } @@ -155,7 +155,7 @@ public class EnpassPasswordManager implements PasswordManager { !login.isEmpty() ? login : null, !secret.isEmpty() ? InPlaceSecretValue.of(secret) : null); } } catch (Exception ex) { - ErrorEvent.fromThrowable(ex).handle(); + ErrorEventFactory.fromThrowable(ex).handle(); return null; } } diff --git a/app/src/main/java/io/xpipe/app/pwman/KeePassXcPasswordManager.java b/app/src/main/java/io/xpipe/app/pwman/KeePassXcPasswordManager.java index e0a04cac7..bc6640582 100644 --- a/app/src/main/java/io/xpipe/app/pwman/KeePassXcPasswordManager.java +++ b/app/src/main/java/io/xpipe/app/pwman/KeePassXcPasswordManager.java @@ -2,7 +2,7 @@ package io.xpipe.app.pwman; import io.xpipe.app.comp.base.ButtonComp; import io.xpipe.app.core.AppI18n; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.util.*; import io.xpipe.core.process.OsType; @@ -71,7 +71,7 @@ public class KeePassXcPasswordManager implements PasswordManager { private static KeePassXcAssociationKey associate() throws IOException { var found = findKeePassProxy(); if (found.isEmpty()) { - throw ErrorEvent.expected(new UnsupportedOperationException("No KeePassXC installation was found")); + throw ErrorEventFactory.expected(new UnsupportedOperationException("No KeePassXC installation was found")); } var c = new KeePassXcProxyClient(found.get()); @@ -106,7 +106,7 @@ public class KeePassXcPasswordManager implements PasswordManager { if (client == null) { var found = findKeePassProxy(); if (found.isEmpty()) { - throw ErrorEvent.expected(new UnsupportedOperationException("No KeePassXC installation was found")); + throw ErrorEventFactory.expected(new UnsupportedOperationException("No KeePassXC installation was found")); } var c = new KeePassXcProxyClient(found.get()); @@ -120,7 +120,7 @@ public class KeePassXcPasswordManager implements PasswordManager { try { c.testAssociation(); } catch (Exception e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); c.useExistingAssociationKey(null); cached = null; } @@ -152,7 +152,7 @@ public class KeePassXcPasswordManager implements PasswordManager { } } catch (Exception e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); } return switch (OsType.getLocal()) { @@ -182,7 +182,7 @@ public class KeePassXcPasswordManager implements PasswordManager { } } } catch (Exception e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); } yield Optional.empty(); } @@ -194,7 +194,7 @@ public class KeePassXcPasswordManager implements PasswordManager { try { return KeePassXcPasswordManager.receive(key); } catch (Exception e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); return null; } } diff --git a/app/src/main/java/io/xpipe/app/pwman/KeePassXcProxyClient.java b/app/src/main/java/io/xpipe/app/pwman/KeePassXcProxyClient.java index 3ae5f424a..bef47aa34 100644 --- a/app/src/main/java/io/xpipe/app/pwman/KeePassXcProxyClient.java +++ b/app/src/main/java/io/xpipe/app/pwman/KeePassXcProxyClient.java @@ -1,6 +1,6 @@ package io.xpipe.app.pwman; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.util.DocumentationLink; import io.xpipe.app.util.ThreadHelper; import io.xpipe.core.util.InPlaceSecretValue; @@ -154,7 +154,7 @@ public class KeePassXcProxyClient { var ex = new IllegalStateException( "KeePassXC client did not respond. Is the browser integration enabled for your KeePassXC database?"); - ErrorEvent.preconfigure(ErrorEvent.fromThrowable(ex).expected().documentationLink(DocumentationLink.KEEPASSXC)); + ErrorEventFactory.preconfigure(ErrorEventFactory.fromThrowable(ex).expected().documentationLink(DocumentationLink.KEEPASSXC)); throw ex; } @@ -167,7 +167,7 @@ public class KeePassXcProxyClient { public void testAssociation() throws IOException { if (associationKey == null) { // We need to do an association first - throw ErrorEvent.expected(new IllegalStateException("KeePassXC association failed or was cancelled")); + throw ErrorEventFactory.expected(new IllegalStateException("KeePassXC association failed or was cancelled")); } // Generate a nonce @@ -201,7 +201,7 @@ public class KeePassXcProxyClient { Map responseMap = jsonToMap(responseJson); if (responseMap.containsKey("error")) { - throw ErrorEvent.expected( + throw ErrorEventFactory.expected( new IllegalStateException(responseMap.get("error").toString())); } @@ -259,7 +259,7 @@ public class KeePassXcProxyClient { Map responseMap = jsonToMap(responseJson); if (responseMap.containsKey("error")) { - throw ErrorEvent.expected( + throw ErrorEventFactory.expected( new IllegalStateException(responseMap.get("error").toString())); } @@ -276,11 +276,11 @@ public class KeePassXcProxyClient { var tree = JacksonMapper.getDefault().readTree(message); var count = tree.required("count").asInt(); if (count == 0) { - throw ErrorEvent.expected(new IllegalArgumentException("No password was found for specified key")); + throw ErrorEventFactory.expected(new IllegalArgumentException("No password was found for specified key")); } if (count > 1) { - throw ErrorEvent.expected( + throw ErrorEventFactory.expected( new IllegalArgumentException("Password key is ambiguous and returned multiple results")); } @@ -468,7 +468,7 @@ public class KeePassXcProxyClient { Map responseMap = jsonToMap(responseJson); if (responseMap.containsKey("error")) { - throw ErrorEvent.expected( + throw ErrorEventFactory.expected( new IllegalStateException(responseMap.get("error").toString())); } diff --git a/app/src/main/java/io/xpipe/app/pwman/KeeperPasswordManager.java b/app/src/main/java/io/xpipe/app/pwman/KeeperPasswordManager.java index 5308f6f2c..35b59178c 100644 --- a/app/src/main/java/io/xpipe/app/pwman/KeeperPasswordManager.java +++ b/app/src/main/java/io/xpipe/app/pwman/KeeperPasswordManager.java @@ -1,7 +1,7 @@ package io.xpipe.app.pwman; import io.xpipe.app.ext.ProcessControlProvider; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.terminal.TerminalLauncher; import io.xpipe.app.util.CommandSupport; import io.xpipe.app.util.SecretManager; @@ -40,7 +40,7 @@ public class KeeperPasswordManager implements PasswordManager { try { CommandSupport.isInLocalPathOrThrow("Keeper Commander CLI", "keeper"); } catch (Exception e) { - ErrorEvent.fromThrowable(e) + ErrorEventFactory.fromThrowable(e) .link("https://docs.keeper.io/en/keeperpam/commander-cli/commander-installation-setup") .handle(); return null; @@ -101,7 +101,7 @@ public class KeeperPasswordManager implements PasswordManager { return new CredentialResult(login, password != null ? InPlaceSecretValue.of(password) : null); } catch (Exception ex) { - ErrorEvent.fromThrowable(ex).handle(); + ErrorEventFactory.fromThrowable(ex).handle(); return null; } } diff --git a/app/src/main/java/io/xpipe/app/pwman/LastpassPasswordManager.java b/app/src/main/java/io/xpipe/app/pwman/LastpassPasswordManager.java index b06434354..0c9b6ef87 100644 --- a/app/src/main/java/io/xpipe/app/pwman/LastpassPasswordManager.java +++ b/app/src/main/java/io/xpipe/app/pwman/LastpassPasswordManager.java @@ -1,7 +1,7 @@ package io.xpipe.app.pwman; import io.xpipe.app.ext.ProcessControlProvider; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.terminal.TerminalLauncher; import io.xpipe.app.util.*; import io.xpipe.core.process.*; @@ -30,7 +30,7 @@ public class LastpassPasswordManager implements PasswordManager { try { CommandSupport.isInLocalPathOrThrow("LastPass CLI", "lpass"); } catch (Exception e) { - ErrorEvent.fromThrowable(e) + ErrorEventFactory.fromThrowable(e) .link("https://github.com/LastPass/lastpass-cli") .handle(); return null; @@ -68,7 +68,7 @@ public class LastpassPasswordManager implements PasswordManager { matches.add(title.asText()); } }); - throw ErrorEvent.expected(new IllegalArgumentException( + throw ErrorEventFactory.expected(new IllegalArgumentException( "Ambiguous item name, multiple password entries match: " + String.join(", ", matches))); } @@ -78,7 +78,7 @@ public class LastpassPasswordManager implements PasswordManager { !username.isEmpty() ? username : null, !password.isEmpty() ? InPlaceSecretValue.of(password) : null); } catch (Exception ex) { - ErrorEvent.fromThrowable(ex).handle(); + ErrorEventFactory.fromThrowable(ex).handle(); return null; } } diff --git a/app/src/main/java/io/xpipe/app/pwman/OnePasswordManager.java b/app/src/main/java/io/xpipe/app/pwman/OnePasswordManager.java index e58191087..bf79a7ba2 100644 --- a/app/src/main/java/io/xpipe/app/pwman/OnePasswordManager.java +++ b/app/src/main/java/io/xpipe/app/pwman/OnePasswordManager.java @@ -2,7 +2,7 @@ package io.xpipe.app.pwman; import io.xpipe.app.core.AppI18n; import io.xpipe.app.ext.ProcessControlProvider; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.util.CommandSupport; import io.xpipe.core.process.CommandBuilder; import io.xpipe.core.process.ShellControl; @@ -29,7 +29,7 @@ public class OnePasswordManager implements PasswordManager { try { CommandSupport.isInLocalPathOrThrow("1Password CLI", "op"); } catch (Exception e) { - ErrorEvent.fromThrowable(e) + ErrorEventFactory.fromThrowable(e) .expected() .link("https://developer.1password.com/docs/cli/get-started/") .handle(); @@ -55,7 +55,7 @@ public class OnePasswordManager implements PasswordManager { username != null ? username.asText() : null, password != null ? InPlaceSecretValue.of(password.asText()) : null); } catch (Exception e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); return null; } } diff --git a/app/src/main/java/io/xpipe/app/pwman/PasswordManagerCommand.java b/app/src/main/java/io/xpipe/app/pwman/PasswordManagerCommand.java index 42d39e10b..dc030b629 100644 --- a/app/src/main/java/io/xpipe/app/pwman/PasswordManagerCommand.java +++ b/app/src/main/java/io/xpipe/app/pwman/PasswordManagerCommand.java @@ -5,7 +5,7 @@ import io.xpipe.app.comp.base.IntegratedTextAreaComp; import io.xpipe.app.core.AppFontSizes; import io.xpipe.app.core.AppI18n; import io.xpipe.app.ext.ProcessControlProvider; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.prefs.ExternalApplicationHelper; import io.xpipe.app.storage.DataStorage; import io.xpipe.app.util.*; @@ -89,7 +89,7 @@ public class PasswordManagerCommand implements PasswordManager { return InPlaceSecretValue.of(out); } catch (Exception ex) { - ErrorEvent.fromThrowable("Unable to retrieve password with command " + cmd, ex) + ErrorEventFactory.fromThrowable("Unable to retrieve password with command " + cmd, ex) .expected() .handle(); return null; diff --git a/app/src/main/java/io/xpipe/app/pwman/PsonoPasswordManager.java b/app/src/main/java/io/xpipe/app/pwman/PsonoPasswordManager.java index bca3a137a..00e723247 100644 --- a/app/src/main/java/io/xpipe/app/pwman/PsonoPasswordManager.java +++ b/app/src/main/java/io/xpipe/app/pwman/PsonoPasswordManager.java @@ -4,7 +4,7 @@ import io.xpipe.app.comp.base.SecretFieldComp; import io.xpipe.app.comp.base.TextFieldComp; import io.xpipe.app.core.AppI18n; import io.xpipe.app.ext.ProcessControlProvider; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.util.*; import io.xpipe.core.process.CommandBuilder; import io.xpipe.core.process.ShellControl; @@ -75,7 +75,7 @@ public class PsonoPasswordManager implements PasswordManager { try { CommandSupport.isInLocalPathOrThrow("Psono CLI", "psonoci"); } catch (Exception e) { - ErrorEvent.fromThrowable(e) + ErrorEventFactory.fromThrowable(e) .expected() .link("https://doc.psono.com/user/psonoci/install.html") .handle(); @@ -103,7 +103,7 @@ public class PsonoPasswordManager implements PasswordManager { username.isNull() ? null : username.asText(), password.isNull() ? null : InPlaceSecretValue.of(password.asText())); } catch (Exception e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); return null; } } diff --git a/app/src/main/java/io/xpipe/app/pwman/WindowsCredentialManager.java b/app/src/main/java/io/xpipe/app/pwman/WindowsCredentialManager.java index cebe2e3e4..ef700ba09 100644 --- a/app/src/main/java/io/xpipe/app/pwman/WindowsCredentialManager.java +++ b/app/src/main/java/io/xpipe/app/pwman/WindowsCredentialManager.java @@ -1,6 +1,6 @@ package io.xpipe.app.pwman; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.util.LocalShell; import io.xpipe.core.util.InPlaceSecretValue; @@ -98,7 +98,7 @@ public class WindowsCredentialManager implements PasswordManager { .readStdoutOrThrow(); return new CredentialResult(username, password.isEmpty() ? null : InPlaceSecretValue.of(password)); } catch (Exception ex) { - ErrorEvent.fromThrowable(ex).expected().handle(); + ErrorEventFactory.fromThrowable(ex).expected().handle(); return null; } } diff --git a/app/src/main/java/io/xpipe/app/rdp/CustomRdpClient.java b/app/src/main/java/io/xpipe/app/rdp/CustomRdpClient.java index d1fa871ce..344012941 100644 --- a/app/src/main/java/io/xpipe/app/rdp/CustomRdpClient.java +++ b/app/src/main/java/io/xpipe/app/rdp/CustomRdpClient.java @@ -1,6 +1,6 @@ package io.xpipe.app.rdp; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.prefs.ExternalApplicationHelper; import io.xpipe.app.prefs.ExternalApplicationType; @@ -14,7 +14,7 @@ public class CustomRdpClient implements ExternalApplicationType, ExternalRdpClie public void launch(RdpLaunchConfig configuration) throws Exception { var customCommand = AppPrefs.get().customRdpClientCommand().getValue(); if (customCommand == null || customCommand.isBlank()) { - throw ErrorEvent.expected(new IllegalStateException("No custom RDP command specified")); + throw ErrorEventFactory.expected(new IllegalStateException("No custom RDP command specified")); } var format = diff --git a/app/src/main/java/io/xpipe/app/rdp/DevolutionsRdpClient.java b/app/src/main/java/io/xpipe/app/rdp/DevolutionsRdpClient.java index 2ca3abce6..29826588c 100644 --- a/app/src/main/java/io/xpipe/app/rdp/DevolutionsRdpClient.java +++ b/app/src/main/java/io/xpipe/app/rdp/DevolutionsRdpClient.java @@ -1,6 +1,6 @@ package io.xpipe.app.rdp; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.prefs.ExternalApplicationType; import io.xpipe.app.util.ThreadHelper; import io.xpipe.app.util.WindowsRegistry; @@ -31,7 +31,7 @@ public class DevolutionsRdpClient implements ExternalApplicationType.WindowsType WindowsRegistry.HKEY_LOCAL_MACHINE, "SOFTWARE\\Classes\\rdm\\DefaultIcon"); return r.map(Path::of); } catch (Exception e) { - ErrorEvent.fromThrowable(e).omit().handle(); + ErrorEventFactory.fromThrowable(e).omit().handle(); return Optional.empty(); } } diff --git a/app/src/main/java/io/xpipe/app/storage/DataStorage.java b/app/src/main/java/io/xpipe/app/storage/DataStorage.java index 9e5d79ccf..12a35ba8d 100644 --- a/app/src/main/java/io/xpipe/app/storage/DataStorage.java +++ b/app/src/main/java/io/xpipe/app/storage/DataStorage.java @@ -4,7 +4,7 @@ import io.xpipe.app.core.AppProperties; import io.xpipe.app.ext.LocalStore; import io.xpipe.app.ext.NameableStore; import io.xpipe.app.hub.comp.StoreSortMode; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.issue.TrackEvent; import io.xpipe.app.util.FixedHierarchyStore; import io.xpipe.app.util.ThreadHelper; @@ -452,7 +452,7 @@ public abstract class DataStorage { if (throwOnFail) { throw ex; } else { - ErrorEvent.fromThrowable(ex).handle(); + ErrorEventFactory.fromThrowable(ex).handle(); return false; } } finally { diff --git a/app/src/main/java/io/xpipe/app/storage/DataStorageNode.java b/app/src/main/java/io/xpipe/app/storage/DataStorageNode.java index a5d2bd984..7e95792b6 100644 --- a/app/src/main/java/io/xpipe/app/storage/DataStorageNode.java +++ b/app/src/main/java/io/xpipe/app/storage/DataStorageNode.java @@ -1,7 +1,7 @@ package io.xpipe.app.storage; import io.xpipe.app.ext.UserScopeStore; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.util.EncryptionToken; import io.xpipe.core.store.DataStore; @@ -99,7 +99,7 @@ public class DataStorageNode { var currentUser = secret.getEncryptedToken().isUser(); return new DataStorageNode(read, currentUser, true, true); } catch (Exception e) { - ErrorEvent.fromThrowable(e).build().handle(); + ErrorEventFactory.fromThrowable(e).build().handle(); return fail(); } } @@ -114,7 +114,7 @@ public class DataStorageNode { try (JsonGenerator g = f.createGenerator(writer).setPrettyPrinter(new DefaultPrettyPrinter())) { JacksonMapper.getDefault().writeTree(g, node.getContentNode()); } catch (IOException e) { - ErrorEvent.fromThrowable(e).build().handle(); + ErrorEventFactory.fromThrowable(e).build().handle(); return node.getContentNode(); } 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 553cf356c..2ed7de8ca 100644 --- a/app/src/main/java/io/xpipe/app/storage/DataStoreEntry.java +++ b/app/src/main/java/io/xpipe/app/storage/DataStoreEntry.java @@ -4,7 +4,7 @@ import io.xpipe.app.ext.DataStoreProvider; import io.xpipe.app.ext.DataStoreProviders; import io.xpipe.app.ext.NameableStore; import io.xpipe.app.ext.UserScopeStore; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.util.ThreadHelper; import io.xpipe.core.store.*; import io.xpipe.core.util.JacksonMapper; @@ -299,7 +299,7 @@ public class DataStoreEntry extends StorageElement { var fileNode = mapper.readTree(storeFile.toFile()); node = DataStorageNode.readPossiblyEncryptedNode(fileNode); } catch (JacksonException ex) { - ErrorEvent.fromThrowable(ex).omit().expected().handle(); + ErrorEventFactory.fromThrowable(ex).omit().expected().handle(); node = DataStorageNode.fail(); } @@ -575,7 +575,7 @@ public class DataStoreEntry extends StorageElement { try { validateOrThrow(); } catch (Throwable ex) { - ErrorEvent.fromThrowable(ex).handle(); + ErrorEventFactory.fromThrowable(ex).handle(); } } @@ -608,7 +608,7 @@ public class DataStoreEntry extends StorageElement { // Check whether we have a provider as well DataStoreProviders.byStore(newStore); } catch (Throwable e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); newStore = null; } @@ -647,7 +647,7 @@ public class DataStoreEntry extends StorageElement { notifyUpdate(false, false); lifecycleStore.initializeStore(); } catch (Exception e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); } finally { decrementBusyCounter(); notifyUpdate(false, false); @@ -662,7 +662,7 @@ public class DataStoreEntry extends StorageElement { notifyUpdate(false, false); lifecycleStore.finalizeStore(); } catch (Exception e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); } finally { decrementBusyCounter(); notifyUpdate(false, false); diff --git a/app/src/main/java/io/xpipe/app/storage/StandardStorage.java b/app/src/main/java/io/xpipe/app/storage/StandardStorage.java index f6976759c..408a1c990 100644 --- a/app/src/main/java/io/xpipe/app/storage/StandardStorage.java +++ b/app/src/main/java/io/xpipe/app/storage/StandardStorage.java @@ -2,7 +2,7 @@ package io.xpipe.app.storage; import io.xpipe.app.ext.DataStorageExtensionProvider; import io.xpipe.app.ext.LocalStore; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.issue.TrackEvent; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.util.EncryptionKey; @@ -59,7 +59,7 @@ public class StandardStorage extends DataStorage { try { FileUtils.forceMkdir(dir.toFile()); } catch (Exception e) { - ErrorEvent.fromThrowable("Unable to create vault directory", e) + ErrorEventFactory.fromThrowable("Unable to create vault directory", e) .terminal(true) .build() .handle(); @@ -68,7 +68,7 @@ public class StandardStorage extends DataStorage { try { initSystemInfo(); } catch (Exception e) { - ErrorEvent.fromThrowable("Unable to load vault system info", e) + ErrorEventFactory.fromThrowable("Unable to load vault system info", e) .build() .handle(); } @@ -78,7 +78,7 @@ public class StandardStorage extends DataStorage { try { dataStorageUserHandler.init(); } catch (IOException e) { - ErrorEvent.fromThrowable("Unable to load vault users", e) + ErrorEventFactory.fromThrowable("Unable to load vault users", e) .terminal(true) .build() .handle(); @@ -98,7 +98,7 @@ public class StandardStorage extends DataStorage { FileUtils.forceMkdir(categoriesDir.toFile()); FileUtils.forceMkdir(dataDir.toFile()); } catch (Exception e) { - ErrorEvent.fromThrowable("Unable to create vault directory", e) + ErrorEventFactory.fromThrowable("Unable to create vault directory", e) .terminal(true) .build() .handle(); @@ -123,14 +123,14 @@ public class StandardStorage extends DataStorage { directoriesToKeep.add(path); } catch (Exception ex) { // Data corruption and schema changes are expected - ErrorEvent.fromThrowable(ex).expected().omit().build().handle(); + ErrorEventFactory.fromThrowable(ex).expected().omit().build().handle(); } }); } // Show one exception if (exception.get() != null) { - ErrorEvent.fromThrowable(exception.get()).handle(); + ErrorEventFactory.fromThrowable(exception.get()).handle(); } setupBuiltinCategories(); @@ -169,13 +169,13 @@ public class StandardStorage extends DataStorage { directoriesToKeep.add(path); } - ErrorEvent.fromThrowable(ex).expected().omit().build().handle(); + ErrorEventFactory.fromThrowable(ex).expected().omit().build().handle(); } }); // Show one exception if (exception.get() != null) { - ErrorEvent.fromThrowable(exception.get()).expected().handle(); + ErrorEventFactory.fromThrowable(exception.get()).expected().handle(); } storeEntriesSet.forEach(e -> { @@ -190,7 +190,7 @@ public class StandardStorage extends DataStorage { }); } } catch (IOException ex) { - ErrorEvent.fromThrowable(ex).terminal(true).build().handle(); + ErrorEventFactory.fromThrowable(ex).terminal(true).build().handle(); } var hasFixedLocal = storeEntriesSet.stream() @@ -204,7 +204,7 @@ public class StandardStorage extends DataStorage { local.deleteFromDisk(); hasFixedLocal = false; } catch (IOException ex) { - ErrorEvent.fromThrowable(ex) + ErrorEventFactory.fromThrowable(ex) .terminal(true) .expected() .build() @@ -299,7 +299,7 @@ public class StandardStorage extends DataStorage { try { p.storageInit(); } catch (Exception e) { - ErrorEvent.fromThrowable(e).omit().handle(); + ErrorEventFactory.fromThrowable(e).omit().handle(); } }); } @@ -354,7 +354,7 @@ public class StandardStorage extends DataStorage { FileUtils.forceMkdir(getStoresDir().toFile()); FileUtils.forceMkdir(getCategoriesDir().toFile()); } catch (Exception e) { - ErrorEvent.fromThrowable(e) + ErrorEventFactory.fromThrowable(e) .description("Unable to create storage directory " + getStoresDir()) .terminal(true) .build() @@ -374,7 +374,7 @@ public class StandardStorage extends DataStorage { exception.set(ex); } catch (Exception ex) { // Data corruption and schema changes are expected - ErrorEvent.fromThrowable(ex).expected().omit().build().handle(); + ErrorEventFactory.fromThrowable(ex).expected().omit().build().handle(); } }); @@ -389,13 +389,13 @@ public class StandardStorage extends DataStorage { } catch (Exception ex) { // Data corruption and schema changes are expected exception.set(ex); - ErrorEvent.fromThrowable(ex).expected().omit().build().handle(); + ErrorEventFactory.fromThrowable(ex).expected().omit().build().handle(); } }); // Show one exception if (exception.get() != null) { - ErrorEvent.fromThrowable(exception.get()).expected().handle(); + ErrorEventFactory.fromThrowable(exception.get()).expected().handle(); } deleteLeftovers(); @@ -447,11 +447,11 @@ public class StandardStorage extends DataStorage { dataStorageSyncHandler.handleDeletion(file, uuid.toString()); } } catch (Exception ex) { - ErrorEvent.fromThrowable(ex).expected().omit().build().handle(); + ErrorEventFactory.fromThrowable(ex).expected().omit().build().handle(); } }); } catch (Exception ex) { - ErrorEvent.fromThrowable(ex).terminal(true).build().handle(); + ErrorEventFactory.fromThrowable(ex).terminal(true).build().handle(); } // Delete leftover directories in categories dir @@ -480,11 +480,11 @@ public class StandardStorage extends DataStorage { dataStorageSyncHandler.handleDeletion(file, uuid.toString()); } } catch (Exception ex) { - ErrorEvent.fromThrowable(ex).expected().omit().build().handle(); + ErrorEventFactory.fromThrowable(ex).expected().omit().build().handle(); } }); } catch (Exception ex) { - ErrorEvent.fromThrowable(ex).terminal(true).build().handle(); + ErrorEventFactory.fromThrowable(ex).terminal(true).build().handle(); } } @@ -502,7 +502,7 @@ public class StandardStorage extends DataStorage { vaultKey = EncryptionKey.getVaultSecretKey(id); } } catch (Exception e) { - ErrorEvent.fromThrowable( + ErrorEventFactory.fromThrowable( "Unable to load vault key file " + file + " to decrypt vault contents. Is it corrupted?", e) .terminal(true) .build() @@ -515,7 +515,7 @@ public class StandardStorage extends DataStorage { if (Files.exists(file)) { var read = Files.readString(file); if (!OsType.getLocal().getName().equals(read)) { - ErrorEvent.fromMessage( + ErrorEventFactory.fromMessage( "This vault was originally created on a different system running " + read + ". Sharing connection information between systems directly might cause some problems." + " If you want to properly synchronize connection information across many systems, you can take a look into the git vault synchronization functionality in the settings.") diff --git a/app/src/main/java/io/xpipe/app/terminal/CustomTerminalType.java b/app/src/main/java/io/xpipe/app/terminal/CustomTerminalType.java index d098db913..d2f301097 100644 --- a/app/src/main/java/io/xpipe/app/terminal/CustomTerminalType.java +++ b/app/src/main/java/io/xpipe/app/terminal/CustomTerminalType.java @@ -1,6 +1,6 @@ package io.xpipe.app.terminal; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.prefs.ExternalApplicationHelper; import io.xpipe.app.prefs.ExternalApplicationType; @@ -30,7 +30,7 @@ public class CustomTerminalType implements ExternalApplicationType, ExternalTerm public void launch(TerminalLaunchConfiguration configuration) throws Exception { var custom = AppPrefs.get().customTerminalCommand().getValue(); if (custom == null || custom.isBlank()) { - throw ErrorEvent.expected(new IllegalStateException("No custom terminal command specified")); + throw ErrorEventFactory.expected(new IllegalStateException("No custom terminal command specified")); } var format = custom.toLowerCase(Locale.ROOT).contains("$cmd") ? custom : custom + " $CMD"; diff --git a/app/src/main/java/io/xpipe/app/terminal/KittyTerminalType.java b/app/src/main/java/io/xpipe/app/terminal/KittyTerminalType.java index 14b7dd931..6e516154c 100644 --- a/app/src/main/java/io/xpipe/app/terminal/KittyTerminalType.java +++ b/app/src/main/java/io/xpipe/app/terminal/KittyTerminalType.java @@ -1,7 +1,7 @@ package io.xpipe.app.terminal; import io.xpipe.app.ext.ProcessControlProvider; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.prefs.ExternalApplicationType; import io.xpipe.app.util.CommandSupport; import io.xpipe.app.util.LocalShell; @@ -105,7 +105,7 @@ public interface KittyTerminalType extends ExternalTerminalType, TrackableTermin try (ShellControl pc = LocalShell.getShell()) { return CommandSupport.findProgram(pc, "kitty").isPresent(); } catch (Exception e) { - ErrorEvent.fromThrowable(e).omit().handle(); + ErrorEventFactory.fromThrowable(e).omit().handle(); return false; } } diff --git a/app/src/main/java/io/xpipe/app/terminal/KonsoleTerminalType.java b/app/src/main/java/io/xpipe/app/terminal/KonsoleTerminalType.java index 4e3336ecb..0ded02d36 100644 --- a/app/src/main/java/io/xpipe/app/terminal/KonsoleTerminalType.java +++ b/app/src/main/java/io/xpipe/app/terminal/KonsoleTerminalType.java @@ -1,7 +1,7 @@ package io.xpipe.app.terminal; import io.xpipe.app.core.AppCache; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.core.process.CommandBuilder; @@ -77,7 +77,7 @@ public class KonsoleTerminalType extends ExternalTerminalType.SimplePathType { AppCache.update("konsoleInstanceOptionSet", true); } catch (IOException e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); } } } diff --git a/app/src/main/java/io/xpipe/app/terminal/MobaXTermTerminalType.java b/app/src/main/java/io/xpipe/app/terminal/MobaXTermTerminalType.java index 3c1127b0a..4afed077e 100644 --- a/app/src/main/java/io/xpipe/app/terminal/MobaXTermTerminalType.java +++ b/app/src/main/java/io/xpipe/app/terminal/MobaXTermTerminalType.java @@ -1,6 +1,6 @@ package io.xpipe.app.terminal; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.prefs.ExternalApplicationType; import io.xpipe.app.util.*; import io.xpipe.core.process.CommandBuilder; @@ -34,7 +34,7 @@ public class MobaXTermTerminalType implements ExternalApplicationType.WindowsTyp WindowsRegistry.HKEY_LOCAL_MACHINE, "SOFTWARE\\Classes\\mobaxterm\\DefaultIcon"); return r.map(Path::of); } catch (Exception e) { - ErrorEvent.fromThrowable(e).omit().handle(); + ErrorEventFactory.fromThrowable(e).omit().handle(); return Optional.empty(); } } diff --git a/app/src/main/java/io/xpipe/app/terminal/SecureCrtTerminalType.java b/app/src/main/java/io/xpipe/app/terminal/SecureCrtTerminalType.java index 1fdf3cc99..c3b611acc 100644 --- a/app/src/main/java/io/xpipe/app/terminal/SecureCrtTerminalType.java +++ b/app/src/main/java/io/xpipe/app/terminal/SecureCrtTerminalType.java @@ -1,6 +1,6 @@ package io.xpipe.app.terminal; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.prefs.ExternalApplicationType; import io.xpipe.app.util.LocalShell; import io.xpipe.app.util.SshLocalBridge; @@ -39,7 +39,7 @@ public class SecureCrtTerminalType implements ExternalApplicationType.WindowsTyp return Optional.of(file); } catch (Exception e) { - ErrorEvent.fromThrowable(e).omit().handle(); + ErrorEventFactory.fromThrowable(e).omit().handle(); return Optional.empty(); } } diff --git a/app/src/main/java/io/xpipe/app/terminal/TerminalLaunchConfiguration.java b/app/src/main/java/io/xpipe/app/terminal/TerminalLaunchConfiguration.java index ba3438c35..a6e43a6c9 100644 --- a/app/src/main/java/io/xpipe/app/terminal/TerminalLaunchConfiguration.java +++ b/app/src/main/java/io/xpipe/app/terminal/TerminalLaunchConfiguration.java @@ -2,7 +2,7 @@ package io.xpipe.app.terminal; import io.xpipe.app.core.AppProperties; import io.xpipe.app.ext.ProcessControlProvider; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.storage.DataStorage; import io.xpipe.app.storage.DataStoreColor; @@ -108,7 +108,7 @@ public class TerminalLaunchConfiguration { var suffix = sc.getOsType() == OsType.MACOS ? "This command is available in the util-linux package which can be installed via homebrew." : "This command is available in the util-linux package."; - throw ErrorEvent.expected(new IllegalStateException( + throw ErrorEventFactory.expected(new IllegalStateException( "Logging requires the script command to be installed. " + suffix)); } diff --git a/app/src/main/java/io/xpipe/app/terminal/TerminalLaunchRequest.java b/app/src/main/java/io/xpipe/app/terminal/TerminalLaunchRequest.java index 7de657035..9c731ff64 100644 --- a/app/src/main/java/io/xpipe/app/terminal/TerminalLaunchRequest.java +++ b/app/src/main/java/io/xpipe/app/terminal/TerminalLaunchRequest.java @@ -1,6 +1,6 @@ package io.xpipe.app.terminal; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.util.ScriptHelper; import io.xpipe.app.util.ThreadHelper; import io.xpipe.beacon.BeaconServerException; @@ -46,7 +46,7 @@ public class TerminalLaunchRequest { } if (getResult() == null) { - throw ErrorEvent.expected(new BeaconServerException("Launch request aborted")); + throw ErrorEventFactory.expected(new BeaconServerException("Launch request aborted")); } var r = getResult(); diff --git a/app/src/main/java/io/xpipe/app/terminal/TerminalLauncher.java b/app/src/main/java/io/xpipe/app/terminal/TerminalLauncher.java index 4dfe7365c..d1b4bdfe3 100644 --- a/app/src/main/java/io/xpipe/app/terminal/TerminalLauncher.java +++ b/app/src/main/java/io/xpipe/app/terminal/TerminalLauncher.java @@ -2,7 +2,7 @@ package io.xpipe.app.terminal; import io.xpipe.app.core.AppI18n; import io.xpipe.app.ext.ProcessControlProvider; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.storage.DataStorage; import io.xpipe.app.storage.DataStoreEntry; @@ -143,7 +143,7 @@ public class TerminalLauncher { throws Exception { var type = AppPrefs.get().terminalType().getValue(); if (type == null) { - throw ErrorEvent.expected(new IllegalStateException(AppI18n.get("noTerminalSet"))); + throw ErrorEventFactory.expected(new IllegalStateException(AppI18n.get("noTerminalSet"))); } var color = entry != null ? DataStorage.get().getEffectiveColor(entry) : null; @@ -213,7 +213,7 @@ public class TerminalLauncher { var modMsg = ex.getMessage() != null && ex.getMessage().contains("Unable to find application named") ? ex.getMessage() + " in installed /Applications on this system" : ex.getMessage(); - throw ErrorEvent.expected(new IOException( + throw ErrorEventFactory.expected(new IOException( "Unable to launch terminal " + type.toTranslatedString().getValue() + ": " + modMsg, ex)); } } diff --git a/app/src/main/java/io/xpipe/app/terminal/TerminalPrompt.java b/app/src/main/java/io/xpipe/app/terminal/TerminalPrompt.java index 849ea799e..156c95b4f 100644 --- a/app/src/main/java/io/xpipe/app/terminal/TerminalPrompt.java +++ b/app/src/main/java/io/xpipe/app/terminal/TerminalPrompt.java @@ -1,6 +1,6 @@ package io.xpipe.app.terminal; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.util.ShellTemp; import io.xpipe.core.process.ShellControl; import io.xpipe.core.process.ShellDialect; @@ -45,7 +45,7 @@ public interface TerminalPrompt { checkCanInstall(sc); install(sc); } catch (Exception e) { - ErrorEvent.fromThrowable(e).omit().handle(); + ErrorEventFactory.fromThrowable(e).omit().handle(); return false; } return true; diff --git a/app/src/main/java/io/xpipe/app/terminal/TerminalPromptManager.java b/app/src/main/java/io/xpipe/app/terminal/TerminalPromptManager.java index eb02e52fa..7b096497a 100644 --- a/app/src/main/java/io/xpipe/app/terminal/TerminalPromptManager.java +++ b/app/src/main/java/io/xpipe/app/terminal/TerminalPromptManager.java @@ -1,6 +1,6 @@ package io.xpipe.app.terminal; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.core.process.ShellControl; @@ -15,7 +15,7 @@ public class TerminalPromptManager { try { sc.withInitSnippet(p.terminalCommand()); } catch (Exception e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); } } } diff --git a/app/src/main/java/io/xpipe/app/terminal/TerminalProxyManager.java b/app/src/main/java/io/xpipe/app/terminal/TerminalProxyManager.java index bf0231d32..1c2f6867b 100644 --- a/app/src/main/java/io/xpipe/app/terminal/TerminalProxyManager.java +++ b/app/src/main/java/io/xpipe/app/terminal/TerminalProxyManager.java @@ -1,7 +1,7 @@ package io.xpipe.app.terminal; import io.xpipe.app.ext.ShellStore; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.storage.DataStorage; import io.xpipe.app.storage.DataStoreEntryRef; @@ -70,7 +70,7 @@ public class TerminalProxyManager { matchingSession.getControl().start(); return Optional.of(matchingSession.getControl()); } catch (Exception ex) { - ErrorEvent.fromThrowable(ex).handle(); + ErrorEventFactory.fromThrowable(ex).handle(); activeSession = new ActiveSession(uuid, null); return Optional.empty(); } @@ -84,7 +84,7 @@ public class TerminalProxyManager { return control; } } catch (Exception ex) { - ErrorEvent.fromThrowable(ex).handle(); + ErrorEventFactory.fromThrowable(ex).handle(); } activeSession = new ActiveSession(uuid, null); return Optional.empty(); diff --git a/app/src/main/java/io/xpipe/app/terminal/TermiusTerminalType.java b/app/src/main/java/io/xpipe/app/terminal/TermiusTerminalType.java index c993d94c6..4d77921c1 100644 --- a/app/src/main/java/io/xpipe/app/terminal/TermiusTerminalType.java +++ b/app/src/main/java/io/xpipe/app/terminal/TermiusTerminalType.java @@ -5,7 +5,7 @@ import io.xpipe.app.comp.base.ModalButton; import io.xpipe.app.comp.base.ModalOverlay; import io.xpipe.app.core.AppCache; import io.xpipe.app.core.AppI18n; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.util.*; import io.xpipe.core.process.OsType; @@ -44,7 +44,7 @@ public class TermiusTerminalType implements ExternalTerminalType { } }; } catch (Exception e) { - ErrorEvent.fromThrowable(e).omit().handle(); + ErrorEventFactory.fromThrowable(e).omit().handle(); return false; } } diff --git a/app/src/main/java/io/xpipe/app/terminal/WaveTerminalType.java b/app/src/main/java/io/xpipe/app/terminal/WaveTerminalType.java index e064e63cc..55e6d12ae 100644 --- a/app/src/main/java/io/xpipe/app/terminal/WaveTerminalType.java +++ b/app/src/main/java/io/xpipe/app/terminal/WaveTerminalType.java @@ -1,6 +1,6 @@ package io.xpipe.app.terminal; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.util.CommandSupport; import io.xpipe.app.util.LocalShell; import io.xpipe.core.process.CommandBuilder; @@ -18,7 +18,7 @@ public interface WaveTerminalType extends ExternalTerminalType, TrackableTermina var wsh = CommandSupport.findProgram(sc, "wsh"); return wsh.isPresent(); } catch (Exception ex) { - ErrorEvent.fromThrowable(ex).handle(); + ErrorEventFactory.fromThrowable(ex).handle(); return false; } } @@ -66,7 +66,7 @@ public interface WaveTerminalType extends ExternalTerminalType, TrackableTermina inPath ? "xpipe open" : XPipeInstallation.getLocalDefaultCliExecutable() + " open"); - throw ErrorEvent.expected(new IllegalStateException(msg)); + throw ErrorEventFactory.expected(new IllegalStateException(msg)); } sc.command(CommandBuilder.of() diff --git a/app/src/main/java/io/xpipe/app/terminal/WezTerminalType.java b/app/src/main/java/io/xpipe/app/terminal/WezTerminalType.java index 04bf1a451..2909fd819 100644 --- a/app/src/main/java/io/xpipe/app/terminal/WezTerminalType.java +++ b/app/src/main/java/io/xpipe/app/terminal/WezTerminalType.java @@ -1,6 +1,6 @@ package io.xpipe.app.terminal; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.prefs.ExternalApplicationHelper; import io.xpipe.app.prefs.ExternalApplicationType; import io.xpipe.app.util.LocalShell; @@ -72,7 +72,7 @@ public interface WezTerminalType extends ExternalTerminalType, TrackableTerminal } } } catch (Exception ex) { - ErrorEvent.fromThrowable(ex).omit().handle(); + ErrorEventFactory.fromThrowable(ex).omit().handle(); } try (ShellControl pc = LocalShell.getShell()) { @@ -80,7 +80,7 @@ public interface WezTerminalType extends ExternalTerminalType, TrackableTerminal return Optional.of(Path.of("wezterm-gui")); } } catch (Exception e) { - ErrorEvent.fromThrowable(e).omit().handle(); + ErrorEventFactory.fromThrowable(e).omit().handle(); } return Optional.empty(); @@ -104,7 +104,7 @@ public interface WezTerminalType extends ExternalTerminalType, TrackableTerminal return pc.executeSimpleBooleanCommand(pc.getShellDialect().getWhichCommand("wezterm")) && pc.executeSimpleBooleanCommand(pc.getShellDialect().getWhichCommand("wezterm-gui")); } catch (Exception e) { - ErrorEvent.fromThrowable(e).omit().handle(); + ErrorEventFactory.fromThrowable(e).omit().handle(); return false; } } diff --git a/app/src/main/java/io/xpipe/app/terminal/WindowsTerminalType.java b/app/src/main/java/io/xpipe/app/terminal/WindowsTerminalType.java index 233690b46..661005545 100644 --- a/app/src/main/java/io/xpipe/app/terminal/WindowsTerminalType.java +++ b/app/src/main/java/io/xpipe/app/terminal/WindowsTerminalType.java @@ -2,7 +2,7 @@ package io.xpipe.app.terminal; import io.xpipe.app.core.AppCache; import io.xpipe.app.core.AppProperties; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.util.LocalShell; import io.xpipe.core.process.CommandBuilder; import io.xpipe.core.store.FileNames; @@ -165,7 +165,7 @@ public interface WindowsTerminalType extends ExternalTerminalType, TrackableTerm @Override public void launch(TerminalLaunchConfiguration configuration) throws Exception { if (!isAvailable()) { - throw ErrorEvent.expected( + throw ErrorEventFactory.expected( new IllegalArgumentException("Windows Terminal Preview is not installed at " + getPath())); } @@ -210,7 +210,7 @@ public interface WindowsTerminalType extends ExternalTerminalType, TrackableTerm @Override public void launch(TerminalLaunchConfiguration configuration) throws Exception { if (!isAvailable()) { - throw ErrorEvent.expected( + throw ErrorEventFactory.expected( new IllegalArgumentException("Windows Terminal Canary is not installed at " + getPath())); } diff --git a/app/src/main/java/io/xpipe/app/terminal/XShellTerminalType.java b/app/src/main/java/io/xpipe/app/terminal/XShellTerminalType.java index fa1207eef..0975dc32d 100644 --- a/app/src/main/java/io/xpipe/app/terminal/XShellTerminalType.java +++ b/app/src/main/java/io/xpipe/app/terminal/XShellTerminalType.java @@ -5,7 +5,7 @@ import io.xpipe.app.comp.base.ModalButton; import io.xpipe.app.comp.base.ModalOverlay; import io.xpipe.app.core.AppCache; import io.xpipe.app.core.AppI18n; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.prefs.ExternalApplicationType; import io.xpipe.app.util.LocalShell; import io.xpipe.app.util.SshLocalBridge; @@ -41,7 +41,7 @@ public class XShellTerminalType implements ExternalApplicationType.WindowsType, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\Xshell.exe"); return r.map(Path::of); } catch (Exception e) { - ErrorEvent.fromThrowable(e).omit().handle(); + ErrorEventFactory.fromThrowable(e).omit().handle(); return Optional.empty(); } } diff --git a/app/src/main/java/io/xpipe/app/update/AppDistributionType.java b/app/src/main/java/io/xpipe/app/update/AppDistributionType.java index 633e2f151..a924eb80b 100644 --- a/app/src/main/java/io/xpipe/app/update/AppDistributionType.java +++ b/app/src/main/java/io/xpipe/app/update/AppDistributionType.java @@ -1,7 +1,7 @@ package io.xpipe.app.update; import io.xpipe.app.core.*; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.issue.TrackEvent; import io.xpipe.app.util.LocalExec; import io.xpipe.app.util.Translatable; @@ -146,7 +146,7 @@ public enum AppDistributionType implements Translatable { return PORTABLE; } } catch (Exception ex) { - ErrorEvent.fromThrowable(ex).omit().handle(); + ErrorEventFactory.fromThrowable(ex).omit().handle(); return PORTABLE; } } else { diff --git a/app/src/main/java/io/xpipe/app/update/AppDownloads.java b/app/src/main/java/io/xpipe/app/update/AppDownloads.java index 46cf3e8dc..737b8047b 100644 --- a/app/src/main/java/io/xpipe/app/update/AppDownloads.java +++ b/app/src/main/java/io/xpipe/app/update/AppDownloads.java @@ -2,7 +2,7 @@ package io.xpipe.app.update; import io.xpipe.app.core.AppLayoutModel; import io.xpipe.app.core.AppProperties; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.issue.TrackEvent; import io.xpipe.app.util.*; import io.xpipe.core.process.OsType; @@ -45,7 +45,7 @@ public class AppDownloads { return downloadFile; } catch (IOException ex) { // All sorts of things can go wrong when downloading, this is expected - ErrorEvent.expected(ex); + ErrorEventFactory.expected(ex); throw ex; } } @@ -116,7 +116,7 @@ public class AppDownloads { var ver = queryLatestVersion(first, securityOnly); return AppRelease.of(ver); } catch (Exception e) { - throw ErrorEvent.expected(e); + throw ErrorEventFactory.expected(e); } } } diff --git a/app/src/main/java/io/xpipe/app/update/ChocoUpdater.java b/app/src/main/java/io/xpipe/app/update/ChocoUpdater.java index d042f0e7d..c77bd9ef5 100644 --- a/app/src/main/java/io/xpipe/app/update/ChocoUpdater.java +++ b/app/src/main/java/io/xpipe/app/update/ChocoUpdater.java @@ -5,7 +5,7 @@ import io.xpipe.app.core.AppCache; import io.xpipe.app.core.AppProperties; import io.xpipe.app.core.AppRestart; import io.xpipe.app.core.mode.OperationMode; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.terminal.TerminalLauncher; import io.xpipe.app.util.Hyperlinks; import io.xpipe.app.util.LocalShell; @@ -134,7 +134,7 @@ public class ChocoUpdater extends UpdateHandler { }); }); } catch (Throwable t) { - ErrorEvent.fromThrowable(t).handle(); + ErrorEventFactory.fromThrowable(t).handle(); preparedUpdate.setValue(null); } } diff --git a/app/src/main/java/io/xpipe/app/update/CommandUpdater.java b/app/src/main/java/io/xpipe/app/update/CommandUpdater.java index 12cd57151..0746fb1af 100644 --- a/app/src/main/java/io/xpipe/app/update/CommandUpdater.java +++ b/app/src/main/java/io/xpipe/app/update/CommandUpdater.java @@ -3,7 +3,7 @@ package io.xpipe.app.update; import io.xpipe.app.comp.base.ModalButton; import io.xpipe.app.core.AppCache; import io.xpipe.app.core.mode.OperationMode; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.terminal.TerminalLauncher; import io.xpipe.app.util.Hyperlinks; import io.xpipe.core.process.ShellScript; @@ -60,7 +60,7 @@ public class CommandUpdater extends PortableUpdater { TerminalLauncher.openDirectFallback("XPipe Updater", sc -> script); }); } catch (Throwable t) { - ErrorEvent.fromThrowable(t).handle(); + ErrorEventFactory.fromThrowable(t).handle(); preparedUpdate.setValue(null); } } diff --git a/app/src/main/java/io/xpipe/app/update/GitHubUpdater.java b/app/src/main/java/io/xpipe/app/update/GitHubUpdater.java index acb6fd7fb..35654e05a 100644 --- a/app/src/main/java/io/xpipe/app/update/GitHubUpdater.java +++ b/app/src/main/java/io/xpipe/app/update/GitHubUpdater.java @@ -3,7 +3,7 @@ package io.xpipe.app.update; import io.xpipe.app.comp.base.ModalButton; import io.xpipe.app.core.AppCache; import io.xpipe.app.core.AppProperties; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.util.Hyperlinks; import java.nio.file.Files; @@ -79,7 +79,7 @@ public class GitHubUpdater extends UpdateHandler { var a = p.getAssetType(); a.installLocal(downloadFile); } catch (Throwable t) { - ErrorEvent.fromThrowable(t).handle(); + ErrorEventFactory.fromThrowable(t).handle(); preparedUpdate.setValue(null); } } diff --git a/app/src/main/java/io/xpipe/app/update/UpdateChangelogAlert.java b/app/src/main/java/io/xpipe/app/update/UpdateChangelogAlert.java index 5bd8a3778..cd5c1bbfb 100644 --- a/app/src/main/java/io/xpipe/app/update/UpdateChangelogAlert.java +++ b/app/src/main/java/io/xpipe/app/update/UpdateChangelogAlert.java @@ -8,6 +8,7 @@ import io.xpipe.app.core.AppI18n; import io.xpipe.app.core.window.AppDialog; import io.xpipe.app.issue.ErrorAction; import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.util.Hyperlinks; public class UpdateChangelogAlert { @@ -17,7 +18,7 @@ public class UpdateChangelogAlert { public static void showIfNeeded() { var update = AppDistributionType.get().getUpdateHandler().getPerformedUpdate(); if (update != null && !AppDistributionType.get().getUpdateHandler().isUpdateSucceeded()) { - ErrorEvent.fromMessage(AppI18n.get("updateFail")) + ErrorEventFactory.fromMessage(AppI18n.get("updateFail")) .customAction(new ErrorAction() { @Override public String getName() { diff --git a/app/src/main/java/io/xpipe/app/update/UpdateHandler.java b/app/src/main/java/io/xpipe/app/update/UpdateHandler.java index d432e9361..67546910b 100644 --- a/app/src/main/java/io/xpipe/app/update/UpdateHandler.java +++ b/app/src/main/java/io/xpipe/app/update/UpdateHandler.java @@ -4,7 +4,7 @@ import io.xpipe.app.comp.base.ModalButton; import io.xpipe.app.core.AppCache; import io.xpipe.app.core.AppProperties; import io.xpipe.app.core.mode.OperationMode; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.issue.TrackEvent; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.util.BooleanScope; @@ -153,7 +153,7 @@ public abstract class UpdateHandler { try { return refreshUpdateCheck(first, securityOnly); } catch (Exception ex) { - ErrorEvent.fromThrowable(ex).discard().handle(); + ErrorEventFactory.fromThrowable(ex).discard().handle(); return null; } } @@ -190,7 +190,7 @@ public abstract class UpdateHandler { UpdateAvailableDialog.showIfNeeded(false); } } catch (Throwable t) { - ErrorEvent.fromThrowable(t).handle(); + ErrorEventFactory.fromThrowable(t).handle(); } } diff --git a/app/src/main/java/io/xpipe/app/update/WingetUpdater.java b/app/src/main/java/io/xpipe/app/update/WingetUpdater.java index cef900139..dcf8a41e3 100644 --- a/app/src/main/java/io/xpipe/app/update/WingetUpdater.java +++ b/app/src/main/java/io/xpipe/app/update/WingetUpdater.java @@ -5,7 +5,7 @@ import io.xpipe.app.core.AppCache; import io.xpipe.app.core.AppProperties; import io.xpipe.app.core.AppRestart; import io.xpipe.app.core.mode.OperationMode; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.terminal.TerminalLauncher; import io.xpipe.app.util.Hyperlinks; import io.xpipe.app.util.LocalShell; @@ -135,7 +135,7 @@ public class WingetUpdater extends UpdateHandler { }); }); } catch (Throwable t) { - ErrorEvent.fromThrowable(t).handle(); + ErrorEventFactory.fromThrowable(t).handle(); preparedUpdate.setValue(null); } } diff --git a/app/src/main/java/io/xpipe/app/util/CommandSupport.java b/app/src/main/java/io/xpipe/app/util/CommandSupport.java index c3996225f..5eb45d92f 100644 --- a/app/src/main/java/io/xpipe/app/util/CommandSupport.java +++ b/app/src/main/java/io/xpipe/app/util/CommandSupport.java @@ -1,6 +1,6 @@ package io.xpipe.app.util; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.storage.DataStorage; import io.xpipe.app.storage.DataStoreEntry; import io.xpipe.core.process.ShellControl; @@ -46,7 +46,7 @@ public class CommandSupport { throws Exception { if (!isInPath(processControl, executable)) { var prefix = displayName != null ? displayName + " executable " + executable : executable + " executable"; - throw ErrorEvent.expected(new IOException( + throw ErrorEventFactory.expected(new IOException( prefix + " not found in PATH" + (connection != null ? " on system " + connection.getName() : ""))); } } @@ -54,7 +54,7 @@ public class CommandSupport { public static void isSupported(FailableSupplier supplier, String displayName, DataStoreEntry connection) throws Exception { if (!supplier.get()) { - throw ErrorEvent.expected(new IOException(displayName + " is not supported" + throw ErrorEventFactory.expected(new IOException(displayName + " is not supported" + (connection != null ? " on system " + connection.getName() : ""))); } } @@ -74,7 +74,7 @@ public class CommandSupport { if (present) { return; } - throw ErrorEvent.expected( + throw ErrorEventFactory.expected( new IOException( prefix + " not found in PATH. Install the executable, add it to the PATH, and refresh the environment by restarting XPipe to fix this.")); diff --git a/app/src/main/java/io/xpipe/app/util/DesktopHelper.java b/app/src/main/java/io/xpipe/app/util/DesktopHelper.java index e5ca7e974..bd206873a 100644 --- a/app/src/main/java/io/xpipe/app/util/DesktopHelper.java +++ b/app/src/main/java/io/xpipe/app/util/DesktopHelper.java @@ -1,6 +1,6 @@ package io.xpipe.app.util; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.update.AppDistributionType; import io.xpipe.core.process.CommandBuilder; import io.xpipe.core.process.OsType; @@ -47,7 +47,7 @@ public class DesktopHelper { pb.start(); } } catch (Exception e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); } } @@ -145,7 +145,7 @@ public class DesktopHelper { Desktop.getDesktop().open(file.toFile()); return; } catch (Exception e) { - ErrorEvent.fromThrowable(e).expected().omitted(xdg).handle(); + ErrorEventFactory.fromThrowable(e).expected().omitted(xdg).handle(); } } @@ -168,7 +168,7 @@ public class DesktopHelper { Desktop.getDesktop().browseFileDirectory(file.toFile()); return; } catch (Exception e) { - ErrorEvent.fromThrowable(e).expected().omitted(xdg).handle(); + ErrorEventFactory.fromThrowable(e).expected().omitted(xdg).handle(); } } diff --git a/app/src/main/java/io/xpipe/app/util/DocumentationLink.java b/app/src/main/java/io/xpipe/app/util/DocumentationLink.java index ea87a9d88..5cc8bd56f 100644 --- a/app/src/main/java/io/xpipe/app/util/DocumentationLink.java +++ b/app/src/main/java/io/xpipe/app/util/DocumentationLink.java @@ -8,6 +8,7 @@ public enum DocumentationLink { MACOS_SETUP("guide/installation#macos"), DOUBLE_PROMPT("troubleshoot/two-step-connections"), LICENSE_ACTIVATION("troubleshoot/license-activation"), + TLS_DECRYPTION("troubleshoot/license-activation#tls-decryption"), PRIVACY("legal/privacy"), EULA("legal/eula"), WEBTOP_UPDATE("guide/webtop#updating"), diff --git a/app/src/main/java/io/xpipe/app/util/FileBridge.java b/app/src/main/java/io/xpipe/app/util/FileBridge.java index 856cc5d47..d9cc17129 100644 --- a/app/src/main/java/io/xpipe/app/util/FileBridge.java +++ b/app/src/main/java/io/xpipe/app/util/FileBridge.java @@ -3,7 +3,7 @@ package io.xpipe.app.util; import io.xpipe.app.browser.action.impl.ApplyFileEditActionProvider; import io.xpipe.app.browser.file.BrowserFileOutput; import io.xpipe.app.core.AppFileWatcher; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.issue.TrackEvent; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.core.process.OsType; @@ -66,7 +66,7 @@ public class FileBridge { } }); } catch (IOException e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); } } @@ -122,7 +122,7 @@ public class FileBridge { event("File doesn't seem to be changed"); } } catch (Exception ex) { - ErrorEvent.fromThrowable(ex).omit().handle(); + ErrorEventFactory.fromThrowable(ex).omit().handle(); } } @@ -165,7 +165,7 @@ public class FileBridge { in.transferTo(out); } } catch (Exception ex) { - ErrorEvent.fromThrowable(ex).handle(); + ErrorEventFactory.fromThrowable(ex).handle(); return; } ext.get().registerChange(); @@ -182,7 +182,7 @@ public class FileBridge { in.transferTo(out); } } catch (Exception ex) { - ErrorEvent.fromThrowable(ex).handle(); + ErrorEventFactory.fromThrowable(ex).handle(); return; } @@ -202,7 +202,7 @@ public class FileBridge { .build(); action.executeSync(); } catch (Exception ex) { - ErrorEvent.fromThrowable(ex).handle(); + ErrorEventFactory.fromThrowable(ex).handle(); } } }); diff --git a/app/src/main/java/io/xpipe/app/util/FileOpener.java b/app/src/main/java/io/xpipe/app/util/FileOpener.java index 09b785270..b0a635334 100644 --- a/app/src/main/java/io/xpipe/app/util/FileOpener.java +++ b/app/src/main/java/io/xpipe/app/util/FileOpener.java @@ -1,7 +1,7 @@ package io.xpipe.app.util; import io.xpipe.app.browser.file.BrowserFileOutput; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.storage.DataStoreEntry; import io.xpipe.core.process.CommandBuilder; @@ -33,7 +33,7 @@ public class FileOpener { try { editor.launch(Path.of(localFile).toRealPath()); } catch (Exception e) { - ErrorEvent.fromThrowable( + ErrorEventFactory.fromThrowable( "Unable to launch editor " + editor.toTranslatedString().getValue() + ".\nMaybe try to use a different editor in the settings.", @@ -67,7 +67,7 @@ public class FileOpener { } } } catch (Throwable e) { - ErrorEvent.fromThrowable("Unable to open file " + localFile, e).handle(); + ErrorEventFactory.fromThrowable("Unable to open file " + localFile, e).handle(); } } @@ -86,7 +86,7 @@ public class FileOpener { pc.executeSimpleCommand("open \"" + localFile + "\""); } } catch (Exception e) { - ErrorEvent.fromThrowable("Unable to open file " + localFile, e).handle(); + ErrorEventFactory.fromThrowable("Unable to open file " + localFile, e).handle(); } } diff --git a/app/src/main/java/io/xpipe/app/util/LocalShell.java b/app/src/main/java/io/xpipe/app/util/LocalShell.java index 1808b6889..2d77db48d 100644 --- a/app/src/main/java/io/xpipe/app/util/LocalShell.java +++ b/app/src/main/java/io/xpipe/app/util/LocalShell.java @@ -1,7 +1,7 @@ package io.xpipe.app.util; import io.xpipe.app.ext.ProcessControlProvider; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.core.process.*; import lombok.Getter; @@ -34,7 +34,7 @@ public class LocalShell { try { local.exitAndWait(); } catch (Exception e) { - ErrorEvent.fromThrowable(e).omit().handle(); + ErrorEventFactory.fromThrowable(e).omit().handle(); local.kill(); } } else { @@ -48,7 +48,7 @@ public class LocalShell { try { localPowershell.exitAndWait(); } catch (Exception e) { - ErrorEvent.fromThrowable(e).omit().handle(); + ErrorEventFactory.fromThrowable(e).omit().handle(); local.kill(); } } else { diff --git a/app/src/main/java/io/xpipe/app/util/NativeBridge.java b/app/src/main/java/io/xpipe/app/util/NativeBridge.java index 5ba9091cf..a85068c25 100644 --- a/app/src/main/java/io/xpipe/app/util/NativeBridge.java +++ b/app/src/main/java/io/xpipe/app/util/NativeBridge.java @@ -1,7 +1,7 @@ package io.xpipe.app.util; import io.xpipe.app.core.AppProperties; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.core.process.OsType; import io.xpipe.core.util.XPipeInstallation; @@ -43,7 +43,7 @@ public class NativeBridge { var l = Native.load("xpipe_bridge", MacOsLibrary.class, Map.of()); macOsLibrary = l; } catch (Throwable t) { - ErrorEvent.fromThrowable(t).handle(); + ErrorEventFactory.fromThrowable(t).handle(); loadingFailed = true; } } diff --git a/app/src/main/java/io/xpipe/app/util/PlatformState.java b/app/src/main/java/io/xpipe/app/util/PlatformState.java index e46490e1d..fc4e64cb3 100644 --- a/app/src/main/java/io/xpipe/app/util/PlatformState.java +++ b/app/src/main/java/io/xpipe/app/util/PlatformState.java @@ -1,7 +1,7 @@ package io.xpipe.app.util; import io.xpipe.app.core.check.AppSystemFontCheck; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.core.process.OsType; @@ -31,7 +31,7 @@ public enum PlatformState { public static Throwable getLastError() { if (expectedError) { - ErrorEvent.expected(lastError); + ErrorEventFactory.expected(lastError); } return lastError; } diff --git a/app/src/main/java/io/xpipe/app/util/PlatformThread.java b/app/src/main/java/io/xpipe/app/util/PlatformThread.java index 9ff32a79a..9a8925a4c 100644 --- a/app/src/main/java/io/xpipe/app/util/PlatformThread.java +++ b/app/src/main/java/io/xpipe/app/util/PlatformThread.java @@ -1,8 +1,8 @@ package io.xpipe.app.util; import io.xpipe.app.core.mode.OperationMode; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import javafx.application.Platform; import javafx.beans.InvalidationListener; import javafx.beans.value.ChangeListener; @@ -282,7 +282,7 @@ public class PlatformThread { Platform.enterNestedEventLoop(key); } catch (IllegalStateException ex) { // We might be in an animation or layout call - ErrorEvent.fromThrowable(ex).omit().expected().handle(); + ErrorEventFactory.fromThrowable(ex).omit().expected().handle(); } } @@ -292,7 +292,7 @@ public class PlatformThread { } catch (IllegalArgumentException ex) { // The event loop might have died somehow // Or we passed an invalid key - ErrorEvent.fromThrowable(ex).omit().expected().handle(); + ErrorEventFactory.fromThrowable(ex).omit().expected().handle(); } } @@ -317,7 +317,7 @@ public class PlatformThread { try { r.run(); } catch (Throwable t) { - ErrorEvent.fromThrowable(t).handle(); + ErrorEventFactory.fromThrowable(t).handle(); } }; @@ -337,7 +337,7 @@ public class PlatformThread { try { r.run(); } catch (Throwable t) { - ErrorEvent.fromThrowable(t).handle(); + ErrorEventFactory.fromThrowable(t).handle(); } }; diff --git a/app/src/main/java/io/xpipe/app/util/RdpConfig.java b/app/src/main/java/io/xpipe/app/util/RdpConfig.java index 2f663e9bd..f8ad606c5 100644 --- a/app/src/main/java/io/xpipe/app/util/RdpConfig.java +++ b/app/src/main/java/io/xpipe/app/util/RdpConfig.java @@ -1,6 +1,6 @@ package io.xpipe.app.util; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.core.store.FilePath; import io.xpipe.core.util.StreamCharset; @@ -28,7 +28,7 @@ public class RdpConfig { return parseContent(content); } catch (NoSuchFileException e) { // Users deleting files is expected - ErrorEvent.expected(e); + ErrorEventFactory.expected(e); throw e; } } diff --git a/app/src/main/java/io/xpipe/app/util/ScanDialogAction.java b/app/src/main/java/io/xpipe/app/util/ScanDialogAction.java index afb45b179..2d90d0c85 100644 --- a/app/src/main/java/io/xpipe/app/util/ScanDialogAction.java +++ b/app/src/main/java/io/xpipe/app/util/ScanDialogAction.java @@ -1,7 +1,7 @@ package io.xpipe.app.util; import io.xpipe.app.ext.ScanProvider; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.storage.DataStoreEntry; import io.xpipe.core.process.ShellControl; import io.xpipe.core.process.ShellTtyState; @@ -55,7 +55,7 @@ public interface ScanDialogAction { } } } catch (Exception ex) { - ErrorEvent.fromThrowable(ex).handle(); + ErrorEventFactory.fromThrowable(ex).handle(); } } return true; diff --git a/app/src/main/java/io/xpipe/app/util/ScanDialogBase.java b/app/src/main/java/io/xpipe/app/util/ScanDialogBase.java index 779f9de06..07f5164ed 100644 --- a/app/src/main/java/io/xpipe/app/util/ScanDialogBase.java +++ b/app/src/main/java/io/xpipe/app/util/ScanDialogBase.java @@ -6,7 +6,7 @@ import io.xpipe.app.comp.base.LoadingOverlayComp; import io.xpipe.app.core.AppI18n; import io.xpipe.app.ext.ScanProvider; import io.xpipe.app.ext.ShellStore; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.storage.DataStorage; import io.xpipe.app.storage.DataStoreEntryRef; @@ -82,7 +82,7 @@ public class ScanDialogBase { try { a.getProvider().scan(entry.get(), sc); } catch (Throwable ex) { - ErrorEvent.fromThrowable(ex).handle(); + ErrorEventFactory.fromThrowable(ex).handle(); } } } diff --git a/app/src/main/java/io/xpipe/app/util/ScanMultiDialogComp.java b/app/src/main/java/io/xpipe/app/util/ScanMultiDialogComp.java index 846ec14cf..5ec2064fe 100644 --- a/app/src/main/java/io/xpipe/app/util/ScanMultiDialogComp.java +++ b/app/src/main/java/io/xpipe/app/util/ScanMultiDialogComp.java @@ -2,7 +2,7 @@ package io.xpipe.app.util; import io.xpipe.app.comp.base.ModalOverlayContentComp; import io.xpipe.app.ext.ShellStore; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.storage.DataStoreEntryRef; import javafx.beans.property.BooleanProperty; @@ -37,7 +37,7 @@ class ScanMultiDialogComp extends ModalOverlayContentComp { try { base.finish(); } catch (Exception e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); } } diff --git a/app/src/main/java/io/xpipe/app/util/ScanSingleDialogComp.java b/app/src/main/java/io/xpipe/app/util/ScanSingleDialogComp.java index 3502783df..bc47b97b2 100644 --- a/app/src/main/java/io/xpipe/app/util/ScanSingleDialogComp.java +++ b/app/src/main/java/io/xpipe/app/util/ScanSingleDialogComp.java @@ -4,7 +4,7 @@ import io.xpipe.app.comp.base.ModalOverlayContentComp; import io.xpipe.app.ext.ShellStore; import io.xpipe.app.hub.comp.StoreChoiceComp; import io.xpipe.app.hub.comp.StoreViewState; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.storage.DataStoreEntryRef; import javafx.beans.property.*; @@ -47,7 +47,7 @@ class ScanSingleDialogComp extends ModalOverlayContentComp { try { base.finish(); } catch (Exception e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); } } diff --git a/app/src/main/java/io/xpipe/app/util/SecretRetrievalStrategy.java b/app/src/main/java/io/xpipe/app/util/SecretRetrievalStrategy.java index a73542ea3..dce245655 100644 --- a/app/src/main/java/io/xpipe/app/util/SecretRetrievalStrategy.java +++ b/app/src/main/java/io/xpipe/app/util/SecretRetrievalStrategy.java @@ -1,7 +1,7 @@ package io.xpipe.app.util; import io.xpipe.app.ext.ProcessControlProvider; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.core.util.InPlaceSecretValue; import io.xpipe.core.util.ValidationException; @@ -140,7 +140,7 @@ public interface SecretRetrievalStrategy { public SecretQueryResult query(String prompt) { var pm = AppPrefs.get().passwordManager().getValue(); if (pm == null) { - ErrorEvent.fromMessage( + ErrorEventFactory.fromMessage( "A password manager was requested but no password manager has been set in the settings menu") .expected() .handle(); @@ -156,7 +156,7 @@ public interface SecretRetrievalStrategy { var seq = CharBuffer.wrap(chars); var newline = seq.chars().anyMatch(value -> value == 10); if (seq.length() == 0 || newline) { - throw ErrorEvent.expected( + throw ErrorEventFactory.expected( new IllegalArgumentException("Received not exactly one output line:\n" + r + "\n\n" + "XPipe requires your password manager command to output only the raw password." + " If the output includes any formatting, messages, or your password key either matched multiple entries or none," @@ -204,7 +204,7 @@ public interface SecretRetrievalStrategy { @Override public SecretQueryResult query(String prompt) { if (command == null || command.isBlank()) { - throw ErrorEvent.expected(new IllegalStateException("No custom command specified")); + throw ErrorEventFactory.expected(new IllegalStateException("No custom command specified")); } try (var cc = ProcessControlProvider.get() @@ -214,7 +214,7 @@ public interface SecretRetrievalStrategy { return new SecretQueryResult( InPlaceSecretValue.of(cc.readStdoutOrThrow()), SecretQueryState.NORMAL); } catch (Exception ex) { - ErrorEvent.fromThrowable("Unable to retrieve password with command " + command, ex) + ErrorEventFactory.fromThrowable("Unable to retrieve password with command " + command, ex) .handle(); return new SecretQueryResult(null, SecretQueryState.RETRIEVAL_FAILURE); } diff --git a/app/src/main/java/io/xpipe/app/util/ShellTemp.java b/app/src/main/java/io/xpipe/app/util/ShellTemp.java index f0d41eb98..0b08b3137 100644 --- a/app/src/main/java/io/xpipe/app/util/ShellTemp.java +++ b/app/src/main/java/io/xpipe/app/util/ShellTemp.java @@ -1,6 +1,6 @@ package io.xpipe.app.util; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.core.process.OsType; import io.xpipe.core.process.ShellControl; import io.xpipe.core.process.ShellDialects; @@ -28,7 +28,7 @@ public class ShellTemp { // We did not set this in earlier versions. If we are running as a different user, it might fail Files.setPosixFilePermissions(temp, PosixFilePermissions.fromString("rwxrwxrwx")); } catch (Exception e) { - ErrorEvent.fromThrowable(e).omit().expected().handle(); + ErrorEventFactory.fromThrowable(e).omit().expected().handle(); } } @@ -69,7 +69,7 @@ public class ShellTemp { var systemTemp = proc.getSystemTemporaryDirectory(); if (!d.directoryExists(proc, systemTemp.toString()).executeAndCheck() || !checkDirectoryPermissions(proc, systemTemp.toString())) { - throw ErrorEvent.expected( + throw ErrorEventFactory.expected( new IOException("No permissions to access system temporary directory %s".formatted(systemTemp))); } diff --git a/app/src/main/java/io/xpipe/app/util/SshLocalBridge.java b/app/src/main/java/io/xpipe/app/util/SshLocalBridge.java index cd94d4496..446f31a40 100644 --- a/app/src/main/java/io/xpipe/app/util/SshLocalBridge.java +++ b/app/src/main/java/io/xpipe/app/util/SshLocalBridge.java @@ -3,7 +3,7 @@ package io.xpipe.app.util; import io.xpipe.app.beacon.AppBeaconServer; import io.xpipe.app.core.AppProperties; import io.xpipe.app.ext.ProcessControlProvider; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.core.process.CommandBuilder; import io.xpipe.core.process.ShellControl; import io.xpipe.core.process.ShellDialects; @@ -230,7 +230,7 @@ public class SshLocalBridge { private static FilePath getSshd(ShellControl sc) throws Exception { var exec = CommandSupport.findProgram(sc, "sshd"); if (exec.isEmpty()) { - throw ErrorEvent.expected( + throw ErrorEventFactory.expected( new IllegalStateException( "No sshd executable found in PATH. The SSH terminal bridge for SSH clients requires a local ssh server to be installed")); } @@ -245,7 +245,7 @@ public class SshLocalBridge { try { INSTANCE.getRunningShell().closeStdin(); } catch (IOException e) { - ErrorEvent.fromThrowable(e).omit().handle(); + ErrorEventFactory.fromThrowable(e).omit().handle(); } INSTANCE.getRunningShell().kill(); INSTANCE = null; diff --git a/app/src/main/java/io/xpipe/app/util/ThreadHelper.java b/app/src/main/java/io/xpipe/app/util/ThreadHelper.java index 72af26f61..4c6357139 100644 --- a/app/src/main/java/io/xpipe/app/util/ThreadHelper.java +++ b/app/src/main/java/io/xpipe/app/util/ThreadHelper.java @@ -1,7 +1,7 @@ package io.xpipe.app.util; import io.xpipe.app.core.AppProperties; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.issue.TrackEvent; import io.xpipe.core.util.FailableRunnable; @@ -44,7 +44,7 @@ public class ThreadHelper { try { r.run(); } catch (Throwable e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); } }); t.setDaemon(true); @@ -78,7 +78,7 @@ public class ThreadHelper { runnable.run(); latch.countDown(); } catch (Throwable e) { - ErrorEvent.fromThrowable(e).terminal(terminal).handle(); + ErrorEventFactory.fromThrowable(e).terminal(terminal).handle(); latch.countDown(); } }); diff --git a/app/src/main/java/io/xpipe/app/util/WindowsRegistry.java b/app/src/main/java/io/xpipe/app/util/WindowsRegistry.java index 919fd1db7..cd3cb6014 100644 --- a/app/src/main/java/io/xpipe/app/util/WindowsRegistry.java +++ b/app/src/main/java/io/xpipe/app/util/WindowsRegistry.java @@ -1,6 +1,6 @@ package io.xpipe.app.util; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.core.process.CommandBuilder; import io.xpipe.core.process.ShellControl; @@ -60,7 +60,7 @@ public abstract class WindowsRegistry { try { return Advapi32Util.registryKeyExists(hkey(hkey), key); } catch (Throwable t) { - ErrorEvent.fromThrowable(t).handle(); + ErrorEventFactory.fromThrowable(t).handle(); return false; } } @@ -71,7 +71,7 @@ public abstract class WindowsRegistry { try { return Arrays.asList(Advapi32Util.registryGetKeys(hkey(hkey), key)); } catch (Throwable t) { - ErrorEvent.fromThrowable(t).handle(); + ErrorEventFactory.fromThrowable(t).handle(); return List.of(); } } @@ -82,7 +82,7 @@ public abstract class WindowsRegistry { try { return Advapi32Util.registryValueExists(hkey(hkey), key, valueName); } catch (Throwable t) { - ErrorEvent.fromThrowable(t).handle(); + ErrorEventFactory.fromThrowable(t).handle(); return false; } } @@ -97,7 +97,7 @@ public abstract class WindowsRegistry { return OptionalInt.of(Advapi32Util.registryGetIntValue(hkey(hkey), key, valueName)); } catch (Throwable t) { - ErrorEvent.fromThrowable(t).handle(); + ErrorEventFactory.fromThrowable(t).handle(); return OptionalInt.empty(); } } @@ -112,7 +112,7 @@ public abstract class WindowsRegistry { return Optional.ofNullable(Advapi32Util.registryGetStringValue(hkey(hkey), key, valueName)); } catch (Throwable t) { - ErrorEvent.fromThrowable(t).handle(); + ErrorEventFactory.fromThrowable(t).handle(); return Optional.empty(); } } diff --git a/app/src/main/java/io/xpipe/app/vnc/TigerVncClient.java b/app/src/main/java/io/xpipe/app/vnc/TigerVncClient.java index 4d135f150..1b43a4349 100644 --- a/app/src/main/java/io/xpipe/app/vnc/TigerVncClient.java +++ b/app/src/main/java/io/xpipe/app/vnc/TigerVncClient.java @@ -1,6 +1,6 @@ package io.xpipe.app.vnc; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.prefs.ExternalApplicationType; import io.xpipe.app.util.LocalShell; import io.xpipe.core.process.CommandBuilder; @@ -86,7 +86,7 @@ public abstract class TigerVncClient implements ExternalVncClient { try { return LocalShell.getShell().view().findProgram("vncpasswd").isPresent(); } catch (Exception e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); return false; } } @@ -134,7 +134,7 @@ public abstract class TigerVncClient implements ExternalVncClient { .filter(path -> path.toString().contains("TigerVNC viewer")) .findFirst(); } catch (IOException e) { - ErrorEvent.fromThrowable(e).handle(); + ErrorEventFactory.fromThrowable(e).handle(); return Optional.empty(); } } diff --git a/ext/base/src/main/java/io/xpipe/ext/base/identity/PasswordManagerIdentityStore.java b/ext/base/src/main/java/io/xpipe/ext/base/identity/PasswordManagerIdentityStore.java index 67dd08a02..16b94a191 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/identity/PasswordManagerIdentityStore.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/identity/PasswordManagerIdentityStore.java @@ -1,6 +1,6 @@ package io.xpipe.ext.base.identity; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.pwman.PasswordManager; import io.xpipe.app.util.*; @@ -53,7 +53,7 @@ public class PasswordManagerIdentityStore extends IdentityStore implements Inter var r = AppPrefs.get().passwordManager().getValue().retrieveCredentials(key); if (r == null) { - throw ErrorEvent.expected(new UnsupportedOperationException("Credentials were requested but not supplied")); + throw ErrorEventFactory.expected(new UnsupportedOperationException("Credentials were requested but not supplied")); } setCache("lastQueried", Instant.now()); diff --git a/ext/base/src/main/java/io/xpipe/ext/base/identity/SshIdentityStateManager.java b/ext/base/src/main/java/io/xpipe/ext/base/identity/SshIdentityStateManager.java index 187626921..1ac9b6aed 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/identity/SshIdentityStateManager.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/identity/SshIdentityStateManager.java @@ -2,6 +2,7 @@ package io.xpipe.ext.base.identity; import io.xpipe.app.issue.ErrorAction; import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.util.CommandSupport; import io.xpipe.app.util.LocalShell; import io.xpipe.core.process.*; @@ -27,7 +28,7 @@ public class SshIdentityStateManager { var opensshRunning = opensshList.contains("ssh-agent.exe"); if (external && !gpgRunning && !opensshRunning) { - throw ErrorEvent.expected( + throw ErrorEventFactory.expected( new IllegalStateException( "An external password manager agent is running, but XPipe requested to use another SSH agent. You have to disable the password manager agent first.")); } @@ -41,7 +42,7 @@ public class SshIdentityStateManager { var msg = "The Windows OpenSSH agent is running. This will cause it to interfere with other agents. You have to manually stop the running ssh-agent service to allow other agents to work"; var r = new AtomicBoolean(); - var event = ErrorEvent.fromMessage(msg).expected(); + var event = ErrorEventFactory.fromMessage(msg).expected(); var shutdown = new ErrorAction() { @Override public String getName() { @@ -85,7 +86,7 @@ public class SshIdentityStateManager { public static synchronized void checkAgentIdentities(ShellControl sc, String authSock) throws Exception { var found = sc.view().findProgram("ssh-add"); if (found.isEmpty()) { - throw ErrorEvent.expected(new IllegalStateException( + throw ErrorEventFactory.expected(new IllegalStateException( "SSH agent tool ssh-add not found in PATH. Is the SSH agent correctly installed?")); } @@ -98,8 +99,8 @@ public class SshIdentityStateManager { + "\n" + r[1] + "\nPlease check your SSH agent configuration%s.".formatted(posixMessage)); - var eventBuilder = ErrorEvent.fromThrowable(ex).expected(); - ErrorEvent.preconfigure(eventBuilder); + var eventBuilder = ErrorEventFactory.fromThrowable(ex).expected(); + ErrorEventFactory.preconfigure(eventBuilder); throw ex; } } catch (ProcessOutputException ex) { @@ -125,7 +126,7 @@ public class SshIdentityStateManager { var pipeExists = sc.view().fileExists(FilePath.of("\\\\.\\pipe\\openssh-ssh-agent")); if (!pipeExists) { // No agent is running - throw ErrorEvent.expected( + throw ErrorEventFactory.expected( new IllegalStateException( "An external password manager agent is set for this connection, but no external SSH agent is running. Make sure that the agent is started in your password manager")); } diff --git a/ext/base/src/main/java/io/xpipe/ext/base/identity/SshIdentityStrategy.java b/ext/base/src/main/java/io/xpipe/ext/base/identity/SshIdentityStrategy.java index 4ce12b33c..b6d5906c9 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/identity/SshIdentityStrategy.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/identity/SshIdentityStrategy.java @@ -1,6 +1,6 @@ package io.xpipe.ext.base.identity; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.storage.ContextualFileReference; import io.xpipe.app.storage.DataStorage; import io.xpipe.app.util.SecretRetrievalStrategy; @@ -132,14 +132,14 @@ public interface SshIdentityStrategy { if (!parent.getOsType().equals(OsType.WINDOWS)) { var out = parent.executeSimpleStringCommand("pageant -l"); if (out.isBlank()) { - throw ErrorEvent.expected(new IllegalStateException("Pageant is not running or has no identities")); + throw ErrorEventFactory.expected(new IllegalStateException("Pageant is not running or has no identities")); } var systemAgent = parent.command( parent.getShellDialect().getPrintEnvironmentVariableCommand("SSH_AUTH_SOCK")) .readStdoutOrThrow(); if (!systemAgent.contains("pageant")) { - throw ErrorEvent.expected(new IllegalStateException( + throw ErrorEventFactory.expected(new IllegalStateException( "Pageant is not running as the primary agent via the $SSH_AUTH_SOCK variable.")); } } @@ -171,7 +171,7 @@ public interface SshIdentityStrategy { "Get-ChildItem \"\\\\.\\pipe\\\" -recurse | Where-Object {$_.Name -match \"pageant\"} | foreach {echo $_.Name}"); var lines = pipe.lines().toList(); if (lines.isEmpty()) { - throw ErrorEvent.expected(new IllegalStateException("Pageant is not running")); + throw ErrorEventFactory.expected(new IllegalStateException("Pageant is not running")); } if (lines.size() > 1) { @@ -300,20 +300,20 @@ public interface SshIdentityStrategy { .map(e -> DataStorage.get().getStoreEntryDisplayName(e)); var msg = "Identity file " + resolved + " does not exist" + (systemName.isPresent() ? " on system " + systemName.get() : ""); - throw ErrorEvent.expected(new IllegalArgumentException(msg)); + throw ErrorEventFactory.expected(new IllegalArgumentException(msg)); } if (resolved.endsWith(".ppk")) { var ex = new IllegalArgumentException( "Identity file " + resolved + " is in non-standard PuTTY Private Key format (.ppk), which is not supported by OpenSSH. Please export/convert it to a standard format like .pem via PuTTY"); - ErrorEvent.preconfigure( - ErrorEvent.fromThrowable(ex).expected().link("https://www.puttygen.com/convert-pem-to-ppk")); + ErrorEventFactory.preconfigure( + ErrorEventFactory.fromThrowable(ex).expected().link("https://www.puttygen.com/convert-pem-to-ppk")); throw ex; } if (resolved.endsWith(".pub")) { - throw ErrorEvent.expected(new IllegalArgumentException("Identity file " + resolved + throw ErrorEventFactory.expected(new IllegalArgumentException("Identity file " + resolved + " is marked to be a public key file, SSH authentication requires the private key")); } @@ -414,7 +414,7 @@ public interface SshIdentityStrategy { var file = getFile(parent); if (!parent.getShellDialect().createFileExistsCommand(parent, file).executeAndCheck()) { - throw ErrorEvent.expected(new IOException("Yubikey PKCS11 library at " + file + " not found")); + throw ErrorEventFactory.expected(new IOException("Yubikey PKCS11 library at " + file + " not found")); } } @@ -457,7 +457,7 @@ public interface SshIdentityStrategy { parent.requireLicensedFeature("pkcs11Identity"); if (!parent.getShellDialect().createFileExistsCommand(parent, file).executeAndCheck()) { - throw ErrorEvent.expected(new IOException("PKCS11 library at " + file + " not found")); + throw ErrorEventFactory.expected(new IOException("PKCS11 library at " + file + " not found")); } } diff --git a/ext/base/src/main/java/io/xpipe/ext/base/script/ScriptStoreSetup.java b/ext/base/src/main/java/io/xpipe/ext/base/script/ScriptStoreSetup.java index ce9c71966..746a47d5f 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/script/ScriptStoreSetup.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/script/ScriptStoreSetup.java @@ -1,6 +1,6 @@ package io.xpipe.ext.base.script; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.storage.DataStorage; import io.xpipe.app.storage.DataStoreEntry; import io.xpipe.app.storage.DataStoreEntryRef; @@ -85,7 +85,7 @@ public class ScriptStoreSetup { }); } } catch (StackOverflowError t) { - throw ErrorEvent.expected( + throw ErrorEventFactory.expected( new RuntimeException("Unable to set up scripts. Is there a circular script dependency?", t)); } catch (Throwable t) { throw new RuntimeException("Unable to set up scripts", t); @@ -122,7 +122,7 @@ public class ScriptStoreSetup { return targetDir; } } catch (NumberFormatException e) { - ErrorEvent.fromThrowable(e).expected().omit().handle(); + ErrorEventFactory.fromThrowable(e).expected().omit().handle(); } } diff --git a/ext/system/src/main/java/io/xpipe/ext/system/incus/IncusCommandView.java b/ext/system/src/main/java/io/xpipe/ext/system/incus/IncusCommandView.java index b9e0ed8a1..00bd8b9a0 100644 --- a/ext/system/src/main/java/io/xpipe/ext/system/incus/IncusCommandView.java +++ b/ext/system/src/main/java/io/xpipe/ext/system/incus/IncusCommandView.java @@ -1,7 +1,7 @@ package io.xpipe.ext.system.incus; import io.xpipe.app.ext.ContainerStoreState; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.storage.DataStoreEntry; import io.xpipe.app.storage.DataStoreEntryRef; import io.xpipe.app.util.CommandViewBase; @@ -52,7 +52,7 @@ public class IncusCommandView extends CommandViewBase { } private static T convertException(T s) { - return ErrorEvent.expectedIfContains(s); + return ErrorEventFactory.expectedIfContains(s); } @Override diff --git a/ext/system/src/main/java/io/xpipe/ext/system/lxd/LxdCommandView.java b/ext/system/src/main/java/io/xpipe/ext/system/lxd/LxdCommandView.java index 303c2eea4..b860ad124 100644 --- a/ext/system/src/main/java/io/xpipe/ext/system/lxd/LxdCommandView.java +++ b/ext/system/src/main/java/io/xpipe/ext/system/lxd/LxdCommandView.java @@ -1,7 +1,7 @@ package io.xpipe.ext.system.lxd; import io.xpipe.app.ext.ContainerStoreState; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.storage.DataStoreEntry; import io.xpipe.app.storage.DataStoreEntryRef; import io.xpipe.app.util.CommandViewBase; @@ -50,7 +50,7 @@ public class LxdCommandView extends CommandViewBase { } private static T convertException(T s) { - return ErrorEvent.expectedIfContains(s); + return ErrorEventFactory.expectedIfContains(s); } @Override @@ -147,7 +147,7 @@ public class LxdCommandView extends CommandViewBase { LinkedHashMap::new)); } catch (ProcessOutputException ex) { if (ex.getOutput().contains("Error: unknown shorthand flag: 'f' in -f")) { - throw ErrorEvent.expected(ProcessOutputException.withParagraph("Unsupported legacy LXD version", ex)); + throw ErrorEventFactory.expected(ProcessOutputException.withParagraph("Unsupported legacy LXD version", ex)); } else { throw ex; } diff --git a/ext/system/src/main/java/io/xpipe/ext/system/podman/PodmanCmdStore.java b/ext/system/src/main/java/io/xpipe/ext/system/podman/PodmanCmdStore.java index d151681db..41d15bbf2 100644 --- a/ext/system/src/main/java/io/xpipe/ext/system/podman/PodmanCmdStore.java +++ b/ext/system/src/main/java/io/xpipe/ext/system/podman/PodmanCmdStore.java @@ -2,7 +2,7 @@ package io.xpipe.ext.system.podman; import io.xpipe.app.ext.ContainerStoreState; import io.xpipe.app.ext.ShellStore; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.storage.DataStoreEntry; import io.xpipe.app.storage.DataStoreEntryRef; import io.xpipe.app.util.CommandSupport; @@ -90,7 +90,7 @@ public class PodmanCmdStore var running = view.isDaemonRunning(); if (!running) { setState(getState().toBuilder().running(false).build()); - throw ErrorEvent.expected(new IllegalStateException("Podman daemon is not running")); + throw ErrorEventFactory.expected(new IllegalStateException("Podman daemon is not running")); } updateState(sc); diff --git a/ext/system/src/main/java/io/xpipe/ext/system/podman/PodmanCommandView.java b/ext/system/src/main/java/io/xpipe/ext/system/podman/PodmanCommandView.java index 6af3b9743..e4c5deb8f 100644 --- a/ext/system/src/main/java/io/xpipe/ext/system/podman/PodmanCommandView.java +++ b/ext/system/src/main/java/io/xpipe/ext/system/podman/PodmanCommandView.java @@ -1,6 +1,6 @@ package io.xpipe.ext.system.podman; -import io.xpipe.app.issue.ErrorEvent; +import io.xpipe.app.issue.ErrorEventFactory; import io.xpipe.app.util.CommandView; import io.xpipe.app.util.CommandViewBase; import io.xpipe.core.process.*; @@ -28,7 +28,7 @@ public class PodmanCommandView extends CommandViewBase { } private static T convertException(T s) { - return ErrorEvent.expectedIfContains( + return ErrorEventFactory.expectedIfContains( s, "Error: unable to connect to Podman.", "no connection could be made because the target machine actively refused it.",