mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-24 08:30:27 +00:00
Add better error messages for integrations
This commit is contained in:
parent
6ca4b056e7
commit
b211e10184
2 changed files with 14 additions and 4 deletions
|
@ -57,7 +57,10 @@ public class FileOpener {
|
|||
try {
|
||||
editor.launch(Path.of(file).toRealPath());
|
||||
} catch (Exception e) {
|
||||
ErrorEvent.fromThrowable(e).handle();
|
||||
ErrorEvent.fromThrowable(e)
|
||||
.description("Unable to launch editor " + editor.toTranslatedString()
|
||||
+ ". Maybe try to use a different one in the settings.")
|
||||
.handle();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -71,11 +74,12 @@ public class FileOpener {
|
|||
pc.executeSimpleCommand("open \"" + file + "\"");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ErrorEvent.fromThrowable(e).handle();
|
||||
ErrorEvent.fromThrowable(e)
|
||||
.description("Unable to open file " + file).handle();
|
||||
}
|
||||
}
|
||||
|
||||
public static void openString(String keyName,Object key, String input, Consumer<String> output) {
|
||||
public static void openString(String keyName, Object key, String input, Consumer<String> output) {
|
||||
FileBridge.get().openString(keyName, key, input, output, file -> openInTextEditor(file));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@ import io.xpipe.app.core.AppI18n;
|
|||
import io.xpipe.app.prefs.AppPrefs;
|
||||
import io.xpipe.core.process.CommandControl;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class TerminalHelper {
|
||||
|
||||
public static void open(String title, CommandControl cc) throws Exception {
|
||||
|
@ -21,6 +23,10 @@ public class TerminalHelper {
|
|||
throw new IllegalStateException(AppI18n.get("noTerminalSet"));
|
||||
}
|
||||
|
||||
type.launch(title, command, false);
|
||||
try {
|
||||
type.launch(title, command, false);
|
||||
} catch (Exception ex) {
|
||||
throw new IOException("Unable to launch terminal " + type.toTranslatedString() + ". Maybe try to use a different one in the settings.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue