1
0
Fork 0

disambiguate internal exceptions (#8623)

This commit is contained in:
Jan 2019-03-29 15:59:37 +01:00 committed by GitHub
parent 3a3c360765
commit 9ab9cc7857
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 21 additions and 22 deletions

View File

@ -77,7 +77,7 @@ class AllRowsFetcher {
// SingleRowFetcher instead.
std::pair<ExecutionState, std::shared_ptr<AqlItemBlockShell>> fetchBlockForPassthrough(size_t) {
TRI_ASSERT(false);
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
THROW_ARANGO_EXCEPTION(TRI_ERROR_NOT_IMPLEMENTED);
};
/**

View File

@ -81,7 +81,7 @@ class ConstFetcher {
std::pair<ExecutionState, size_t> preFetchNumberOfRows(size_t atMost) {
// This is not implemented for this fetcher
TRI_ASSERT(false);
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
THROW_ARANGO_EXCEPTION(TRI_ERROR_NOT_IMPLEMENTED);
}
private:

View File

@ -92,13 +92,13 @@ class MultiDependencySingleRowFetcher {
std::pair<ExecutionState, InputAqlItemRow> fetchRow(size_t atMost = ExecutionBlock::DefaultBatchSize()) {
// This is not implemented for this fetcher
TRI_ASSERT(false);
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
THROW_ARANGO_EXCEPTION(TRI_ERROR_NOT_IMPLEMENTED);
}
std::pair<ExecutionState, std::shared_ptr<AqlItemBlockShell>> fetchBlockForPassthrough(size_t atMost) {
// This is not implemented for this fetcher
TRI_ASSERT(false);
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
THROW_ARANGO_EXCEPTION(TRI_ERROR_NOT_IMPLEMENTED);
}
std::pair<ExecutionState, size_t> preFetchNumberOfRows(size_t atMost) {

View File

@ -6603,7 +6603,7 @@ static std::unique_ptr<Condition> buildGeoCondition(ExecutionPlan* plan,
args->addMember(array);
} else {
TRI_ASSERT(false);
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "unsupported geo type");
}
};

View File

@ -114,7 +114,7 @@ class SingleBlockFetcher {
}
std::pair<ExecutionState, std::shared_ptr<AqlItemBlockShell>> fetchBlockForPassthrough(size_t) {
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
THROW_ARANGO_EXCEPTION(TRI_ERROR_NOT_IMPLEMENTED);
};
std::pair<ExecutionState, std::size_t> preFetchNumberOfRows(std::size_t) {

View File

@ -126,7 +126,7 @@ static std::shared_ptr<VPackBuilder> QueryAllUsers(aql::QueryRegistry* queryRegi
if (vocbase == nullptr) {
LOG_TOPIC("b8c47", DEBUG, arangodb::Logger::AUTHENTICATION)
<< "system database is unknown";
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "system database is unknown");
}
// we cannot set this execution context, otherwise the transaction

View File

@ -218,7 +218,7 @@ static void addTransactionHeaderForShard(transaction::Methods& trx,
ClusterTrxMethods::addTransactionHeader(trx, leader, headers);
} else {
TRI_ASSERT(false);
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "couldnt find shard in shardMap");
}
}
} // namespace

View File

@ -93,7 +93,7 @@ ClusterCollection::ClusterCollection(LogicalCollection& collection, ClusterEngin
}
} else if (_engineType != ClusterEngineType::MockEngine) {
TRI_ASSERT(false);
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "invalid storage engine");
}
}
@ -187,7 +187,7 @@ Result ClusterCollection::updateProperties(VPackSlice const& slice, bool doSync)
} else if (_engineType != ClusterEngineType::MockEngine) {
TRI_ASSERT(false);
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "invalid storage engine");
}
merge.close();
TRI_ASSERT(merge.slice().isObject());
@ -244,7 +244,7 @@ void ClusterCollection::getPropertiesVPack(velocypack::Builder& result) const {
} else if (_engineType != ClusterEngineType::MockEngine) {
TRI_ASSERT(false);
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "invalid storage engine");
}
}

View File

@ -75,7 +75,7 @@ AqlValue ViewExpressionContext::getVariableValue(Variable const* var, bool doCop
auto const it = vars.find(var->id);
if (vars.end() == it) {
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "cannot find variable");
}
auto const& varInfo = it->second;

View File

@ -449,11 +449,10 @@ void GraphStore<V, E>::_loadEdges(transaction::Methods& trx, ShardID const& edge
// If this is called from loadDocument we didn't preallocate the vector
if (_edges->size() <= offset) {
if (!_config->lazyLoading()) {
LOG_TOPIC("9d0e6", ERR, Logger::PREGEL) << "Pregel did not preallocate enough "
<< "space for all edges. This hints "
<< "at a bug with collection count()";
std::string msg = "Pregel did not preallocate enough space for all edges. This hints at a bug with collection count()";
LOG_TOPIC("9d0e6", ERR, Logger::PREGEL) << msg;
TRI_ASSERT(false);
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, msg);
}
// lazy loading always uses vector backed storage
((VectorTypedBuffer<Edge<E>>*)_edges)->appendEmptyElement();

View File

@ -180,7 +180,7 @@ void Worker<V, E, M>::prepareGlobalStep(VPackSlice const& data, VPackBuilder& re
if (_state != WorkerState::IDLE) {
LOG_TOPIC("b8506", ERR, Logger::PREGEL)
<< "Cannot prepare a gss when the worker is not idle";
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "Cannot prepare a gss when the worker is not idle");
}
_state = WorkerState::PREPARING; // stop any running step
LOG_TOPIC("f16f2", DEBUG, Logger::PREGEL) << "Received prepare GSS: " << data.toJson();

View File

@ -216,7 +216,7 @@ class RocksDBCuckooIndexEstimator {
LOG_TOPIC("bcd09", WARN, arangodb::Logger::ENGINES)
<< "unable to restore index estimates: invalid format found";
// Do not construct from serialization, use other constructor instead
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "unable to restore index estimates: invalid format found");
}
}
}
@ -809,7 +809,7 @@ class RocksDBCuckooIndexEstimator {
current += sizeof(uint64_t);
if (_size <= 256) {
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "unable to unserialize index estimates");
}
_nrUsed = rocksutils::uint64FromPersistent(current);

View File

@ -1976,13 +1976,13 @@ void TRI_ExpireFoxxQueueDatabaseCache(TRI_vocbase_t* vocbase) {
auto hash = GetKeySpace(vocbase, name);
if (hash == nullptr) {
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "unable to find keyspace");
}
result = hash->keySet(key, 0);
}
if (!result) {
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "unable to set key");
}
}

View File

@ -98,7 +98,7 @@ void Exception::appendLocation() noexcept {
_errorMessage += std::string(" (exception location: ") + _file + ":" +
std::to_string(_line) +
"). Please report this error to arangodb.com";
} else if (_code == TRI_ERROR_OUT_OF_MEMORY) {
} else if (_code == TRI_ERROR_OUT_OF_MEMORY || _code == TRI_ERROR_NOT_IMPLEMENTED) {
_errorMessage += std::string(" (exception location: ") + _file + ":" +
std::to_string(_line) + ")";
}