Ignore askpass exceptions

This commit is contained in:
crschnick
2025-07-23 12:17:51 +00:00
parent b273017627
commit 32c41ca6b0
2 changed files with 12 additions and 1 deletions
@@ -1,6 +1,8 @@
package io.xpipe.app.beacon.impl;
import io.xpipe.app.core.AppLayoutModel;
import io.xpipe.app.issue.ErrorEvent;
import io.xpipe.app.issue.ErrorEventFactory;
import io.xpipe.app.terminal.TerminalView;
import io.xpipe.app.util.*;
import io.xpipe.beacon.BeaconClientException;
@@ -57,7 +59,9 @@ public class AskpassExchangeImpl extends AskpassExchange {
var p = found.get();
var secret = p.process(msg.getPrompt());
if (p.getState() != SecretQueryState.NORMAL) {
throw new BeaconClientException(SecretQueryState.toErrorMessage(p.getState()));
var ex = new BeaconClientException(SecretQueryState.toErrorMessage(p.getState()));
ErrorEventFactory.preconfigure(ErrorEventFactory.fromThrowable(ex).ignore());
throw ex;
}
focusTerminalIfNeeded(msg.getPid());
return Response.builder().value(secret.inPlace()).build();
@@ -110,6 +110,13 @@ public class ErrorEvent {
return omit().expected();
}
public ErrorEventBuilder ignore() {
if (throwable != null) {
HANDLED.add(throwable);
}
return this;
}
public ErrorEvent handle() {
var event = build();
event.handle();