Small fixes

This commit is contained in:
crschnick
2025-05-05 10:05:28 +00:00
parent 5f94a07f78
commit ecc9536a85
4 changed files with 9 additions and 8 deletions
@@ -36,9 +36,6 @@ public class ErrorEvent {
@Setter
private boolean shouldSendDiagnostics;
@Setter
private boolean licenseRequired;
@Singular
private List<Path> attachments;
@@ -36,7 +36,6 @@ public class GuiErrorHandler extends GuiErrorHandlerBase implements ErrorHandler
if (lex.isPresent()) {
LicenseProvider.get().showLicenseAlert(lex.get());
if (!LicenseProvider.get().hasPaidLicense()) {
event.setLicenseRequired(true);
event.clearAttachments();
ErrorAction.ignore().handle(event);
}
@@ -11,6 +11,7 @@ import io.sentry.*;
import io.sentry.protocol.Geo;
import io.sentry.protocol.SentryId;
import io.sentry.protocol.User;
import io.xpipe.app.util.LicenseRequiredException;
import org.apache.commons.io.FileUtils;
import java.io.ByteArrayInputStream;
@@ -57,6 +58,10 @@ public class SentryErrorHandler implements ErrorHandler {
return throwable;
}
if (throwable instanceof LicenseRequiredException) {
return throwable;
}
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
@@ -114,7 +119,7 @@ public class SentryErrorHandler implements ErrorHandler {
}
if (ee.getThrowable() != null) {
var adjusted = adjustCopy(ee.getThrowable(), !ee.isShouldSendDiagnostics() && !ee.isLicenseRequired());
var adjusted = adjustCopy(ee.getThrowable(), !ee.isShouldSendDiagnostics());
return Sentry.captureException(adjusted, sc -> fillScope(ee, sc));
}
@@ -196,7 +201,7 @@ public class SentryErrorHandler implements ErrorHandler {
s.setTag("unhandled", Boolean.toString(ee.isUnhandled()));
s.setTag("diagnostics", Boolean.toString(ee.isShouldSendDiagnostics()));
s.setTag("licenseRequired", Boolean.toString(ee.isLicenseRequired()));
s.setTag("licenseRequired", Boolean.toString(ee.getThrowable() instanceof LicenseRequiredException));
s.setTag(
"fallbackShell",
AppPrefs.get() != null
@@ -207,7 +212,7 @@ public class SentryErrorHandler implements ErrorHandler {
var exMessage = ee.getThrowable() != null ? ee.getThrowable().getMessage() : null;
if (ee.getDescription() != null
&& !ee.getDescription().equals(exMessage)
&& (ee.isShouldSendDiagnostics() || ee.isLicenseRequired())) {
&& (ee.isShouldSendDiagnostics() || ee.getThrowable() instanceof LicenseRequiredException)) {
s.setTag("message", ee.getDescription().lines().collect(Collectors.joining(" ")));
}
@@ -114,7 +114,7 @@ public class ChocoUpdater extends UpdateHandler {
AppCache.update("performedUpdate", performedUpdate);
OperationMode.executeAfterShutdown(() -> {
TerminalLauncher.openDirectFallback("XPipe Updater", sc -> {
var pkg = AppProperties.get().isStaging() ? "xpipe-ptb" : "xpipe";
var pkg = "xpipe";
return ShellScript.lines(
"powershell -Command \"Start-Process -Verb runAs -FilePath choco -ArgumentList upgrade, " + pkg
+ "\"",