use of com.vaticle.typedb.core.common.exception.TypeDBException in project grakn by graknlabs.
the class RocksStorage method exception.
@Override
public TypeDBException exception(Exception exception) {
TypeDBException e;
if (exception instanceof TypeDBException)
e = (TypeDBException) exception;
else
e = TypeDBException.of(exception);
logger().debug(e.getMessage(), e);
return e;
}
use of com.vaticle.typedb.core.common.exception.TypeDBException in project grakn by graknlabs.
the class ConjunctionResolver method initialiseDownstreamResolvers.
@Override
protected void initialiseDownstreamResolvers() {
LOG.debug("{}: initialising downstream resolvers", name());
Set<Concludable> concludables = concludablesTriggeringRules();
Set<Retrievable> retrievables = Retrievable.extractFrom(conjunction(), concludables);
resolvables.addAll(concludables);
resolvables.addAll(retrievables);
iterate(resolvables).forEachRemaining(resolvable -> {
try {
downstreamResolvers.put(resolvable, registry.registerResolvable(resolvable));
} catch (TypeDBException e) {
terminate(e);
}
});
for (Negation negation : conjunction().negations()) {
Negated negated = new Negated(negation);
try {
downstreamResolvers.put(negated, registry.negated(negated, conjunction()));
negateds.add(negated);
} catch (TypeDBException e) {
terminate(e);
}
}
if (!isTerminated())
isInitialised = true;
}
use of com.vaticle.typedb.core.common.exception.TypeDBException in project grakn by graknlabs.
the class CoreConfigTest method config_file_wrong_path_type_throws.
@Test
public void config_file_wrong_path_type_throws() {
Path configInvalidPathType = Util.getTypedbDir().resolve("server/test/config/config-wrong-path-type.yml");
try {
CoreConfigFactory.config(configInvalidPathType, new HashSet<>(), new CoreConfigParser());
fail();
} catch (TypeDBException e) {
assert e.code().isPresent();
assertEquals(CONFIG_UNEXPECTED_VALUE.code(), e.code().get());
assertEquals(CONFIG_UNEXPECTED_VALUE.message("storage.data", "123456[int]", YAMLParser.Value.Primitive.PATH.help()), e.getMessage());
}
}
use of com.vaticle.typedb.core.common.exception.TypeDBException in project grakn by graknlabs.
the class CoreConfigTest method config_file_unrecognised_option.
@Test
public void config_file_unrecognised_option() {
Path configUnrecognisedOption = Util.getTypedbDir().resolve("server/test/config/config-unrecognised-option.yml");
try {
CoreConfigFactory.config(configUnrecognisedOption, new HashSet<>(), new CoreConfigParser());
fail();
} catch (TypeDBException e) {
assert e.code().isPresent();
assertEquals(UNRECOGNISED_CONFIGURATION_OPTIONS.code(), e.code().get());
assertEquals(UNRECOGNISED_CONFIGURATION_OPTIONS.message(list("log.custom-logger-invalid")), e.getMessage());
}
}
use of com.vaticle.typedb.core.common.exception.TypeDBException in project grakn by graknlabs.
the class CoreConfigTest method config_file_missing_debugger_throws.
@Test
public void config_file_missing_debugger_throws() {
Path configMissingLogDebugger = Util.getTypedbDir().resolve("server/test/config/config-missing-debugger.yml");
try {
CoreConfigFactory.config(configMissingLogDebugger, new HashSet<>(), new CoreConfigParser());
fail();
} catch (TypeDBException e) {
assert e.code().isPresent();
assertEquals(MISSING_CONFIG_OPTION.code(), e.code().get());
assertEquals(MISSING_CONFIG_OPTION.message("log.debugger"), e.getMessage());
}
}
Aggregations