mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-23 04:58:59 +00:00
(service) Clean up exceptions when requestScreengrab is not available
This commit is contained in:
parent
48d0a3089a
commit
4da3563d8a
@ -4,6 +4,11 @@ import nu.marginalia.service.discovery.property.ServiceKey;
|
|||||||
|
|
||||||
public class ServiceNotAvailableException extends RuntimeException {
|
public class ServiceNotAvailableException extends RuntimeException {
|
||||||
public ServiceNotAvailableException(ServiceKey<?> key) {
|
public ServiceNotAvailableException(ServiceKey<?> key) {
|
||||||
super("Service " + key + " not available");
|
super(key.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StackTraceElement[] getStackTrace() { // Suppress stack trace
|
||||||
|
return new StackTraceElement[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import com.google.inject.Singleton;
|
|||||||
import nu.marginalia.api.livecapture.LiveCaptureApiGrpc.LiveCaptureApiBlockingStub;
|
import nu.marginalia.api.livecapture.LiveCaptureApiGrpc.LiveCaptureApiBlockingStub;
|
||||||
import nu.marginalia.service.client.GrpcChannelPoolFactory;
|
import nu.marginalia.service.client.GrpcChannelPoolFactory;
|
||||||
import nu.marginalia.service.client.GrpcSingleNodeChannelPool;
|
import nu.marginalia.service.client.GrpcSingleNodeChannelPool;
|
||||||
|
import nu.marginalia.service.client.ServiceNotAvailableException;
|
||||||
import nu.marginalia.service.discovery.property.ServiceKey;
|
import nu.marginalia.service.discovery.property.ServiceKey;
|
||||||
import nu.marginalia.service.discovery.property.ServicePartition;
|
import nu.marginalia.service.discovery.property.ServicePartition;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -29,6 +30,9 @@ public class LiveCaptureClient {
|
|||||||
channelPool.call(LiveCaptureApiBlockingStub::requestScreengrab)
|
channelPool.call(LiveCaptureApiBlockingStub::requestScreengrab)
|
||||||
.run(RpcDomainId.newBuilder().setDomainId(domainId).build());
|
.run(RpcDomainId.newBuilder().setDomainId(domainId).build());
|
||||||
}
|
}
|
||||||
|
catch (ServiceNotAvailableException e) {
|
||||||
|
logger.info("requestScreengrab() failed since the service is not available");
|
||||||
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
logger.error("API Exception", e);
|
logger.error("API Exception", e);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user