wrap checked exception

This commit is contained in:
Jonathan Shook 2024-09-11 15:34:01 -05:00
parent 09c457ed8c
commit cb02fd9f01

View File

@ -2,13 +2,13 @@ package io.nosqlbench.adapter.weaviate.opsdispensers;
/*
* Copyright (c) 2022 nosqlbench
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@ -27,6 +27,7 @@ import io.nosqlbench.adapters.api.activityimpl.BaseOpDispenser;
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import io.weaviate.client.WeaviateClient;
import io.weaviate.client.v1.auth.exception.AuthException;
public abstract class WeaviateBaseOpDispenser<T> extends BaseOpDispenser<WeaviateBaseOp<T>, WeaviateSpace> {
@ -38,7 +39,13 @@ public abstract class WeaviateBaseOpDispenser<T> extends BaseOpDispenser<Weaviat
protected WeaviateBaseOpDispenser(WeaviateDriverAdapter adapter, ParsedOp op, LongFunction<String> targetF) {
super((DriverAdapter) adapter, op);
this.weaviateSpaceFunction = adapter.getSpaceFunc(op);
this.clientFunction = (long l) -> this.weaviateSpaceFunction.apply(l).getClient();
this.clientFunction = (long l) -> {
try {
return this.weaviateSpaceFunction.apply(l).getClient();
} catch (AuthException e) {
throw new RuntimeException(e);
}
};
this.paramF = getParamFunc(this.clientFunction, op, targetF);
this.opF = createOpFunc(paramF, this.clientFunction, op, targetF);
}