renamed UserException to BasicError

This commit is contained in:
Jonathan Shook 2020-03-02 11:45:03 -06:00
parent 5a0557c836
commit 17d16bc7d1
3 changed files with 9 additions and 7 deletions

View File

@ -19,6 +19,7 @@ import io.nosqlbench.engine.api.activityapi.core.ActivityType;
import io.nosqlbench.engine.api.activityapi.core.ProgressMeter;
import io.nosqlbench.engine.api.activityimpl.ActivityDef;
import io.nosqlbench.engine.api.activityimpl.ParameterMap;
import io.nosqlbench.engine.api.exceptions.BasicError;
import io.nosqlbench.engine.api.metrics.ActivityMetrics;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -184,7 +185,7 @@ public class ScenarioController {
String alias = appliedParams.get("alias");
if (alias == null) {
throw new UserException("alias must be provided");
throw new BasicError("alias must be provided");
}
ActivityExecutor executor = activityExecutors.get(alias);
@ -250,7 +251,7 @@ public class ScenarioController {
if (activityTypeName==null) {
String errmsg = "You must provide a type=<activity type> parameter. Valid examples are:\n" +
knownTypes.stream().map(t -> " type="+t+"\n").collect(Collectors.joining());
throw new UserException(errmsg);
throw new BasicError(errmsg);
}
ActivityType<?> activityType = ActivityType.FINDER.getOrThrow(activityTypeName);

View File

@ -20,7 +20,7 @@ import io.nosqlbench.engine.core.ProgressIndicator;
import io.nosqlbench.engine.core.ScenarioController;
import io.nosqlbench.engine.core.ScenarioLogger;
import io.nosqlbench.engine.core.ScenarioResult;
import io.nosqlbench.engine.core.UserException;
import io.nosqlbench.engine.api.exceptions.BasicError;
import io.nosqlbench.engine.api.extensions.ScriptingPluginInfo;
import io.nosqlbench.engine.api.metrics.ActivityMetrics;
import io.nosqlbench.engine.core.metrics.MetricRegistryBindings;
@ -156,7 +156,7 @@ public class Scenario implements Callable<ScenarioResult> {
logger.error(errorDesc, e);
scenarioController.forceStopScenario(5000);
throw new RuntimeException("Script error while running scenario:" + e.getMessage(), e);
} catch (UserException ue) {
} catch (BasicError ue) {
logger.error(ue.getMessage());
scenarioController.forceStopScenario(5000);
throw ue;

View File

@ -17,6 +17,7 @@
package io.nosqlbench.engine.core.script;
import io.nosqlbench.engine.api.exceptions.BasicError;
import io.nosqlbench.engine.core.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -53,7 +54,7 @@ public class ScenariosExecutor {
public synchronized void execute(Scenario scenario, ScenarioLogger scenarioLogger) {
scenario.setScenarioLogger(scenarioLogger);
if (submitted.get(scenario.getName()) != null) {
throw new UserException("Scenario " + scenario.getName() + " is already defined. Remove it first to reuse the name.");
throw new BasicError("Scenario " + scenario.getName() + " is already defined. Remove it first to reuse the name.");
}
Future<ScenarioResult> future = executor.submit(scenario);
SubmittedScenario s = new SubmittedScenario(scenario, future);
@ -83,7 +84,7 @@ public class ScenariosExecutor {
*/
public ScenariosResults awaitAllResults(long timeout, long updateInterval) {
if (updateInterval > timeout) {
throw new UserException("timeout must be equal to or greater than updateInterval");
throw new BasicError("timeout must be equal to or greater than updateInterval");
}
long timeoutAt = System.currentTimeMillis() + timeout;
@ -181,7 +182,7 @@ public class ScenariosExecutor {
Future<ScenarioResult> resultFuture1 = submitted.get(scenarioName).resultFuture;
if (resultFuture1 == null) {
throw new UserException("Unknown scenario name:" + scenarioName);
throw new BasicError("Unknown scenario name:" + scenarioName);
}
if (resultFuture1.isDone()) {
try {