use comparison between ErrorCode and ShardError
This commit is contained in:
parent
d82cfb349e
commit
cd7b33f23f
@ -444,7 +444,7 @@ ShardResult<std::optional<std::pair<VertexAccessor, std::vector<EdgeAccessor>>>>
|
||||
EdgeAccessor e(edge, edge_type, from_vertex, vertex_id, transaction_, &shard_->indices_, config_);
|
||||
auto ret = DeleteEdge(e.FromVertex(), e.ToVertex(), e.Gid());
|
||||
if (ret.HasError()) {
|
||||
MG_ASSERT(ret.GetError().code == common::ErrorCode::SERIALIZATION_ERROR, "Invalid database state!");
|
||||
MG_ASSERT(ret.GetError() == common::ErrorCode::SERIALIZATION_ERROR, "Invalid database state!");
|
||||
return ret.GetError();
|
||||
}
|
||||
|
||||
@ -457,7 +457,7 @@ ShardResult<std::optional<std::pair<VertexAccessor, std::vector<EdgeAccessor>>>>
|
||||
EdgeAccessor e(edge, edge_type, vertex_id, to_vertex, transaction_, &shard_->indices_, config_);
|
||||
auto ret = DeleteEdge(e.FromVertex(), e.ToVertex(), e.Gid());
|
||||
if (ret.HasError()) {
|
||||
MG_ASSERT(ret.GetError().code == common::ErrorCode::SERIALIZATION_ERROR, "Invalid database state!");
|
||||
MG_ASSERT(ret.GetError() == common::ErrorCode::SERIALIZATION_ERROR, "Invalid database state!");
|
||||
return ret.GetError();
|
||||
}
|
||||
|
||||
|
@ -355,16 +355,11 @@ ShardResult<msgs::ExpandOneResultRow> GetExpandOneResult(
|
||||
result_row.src_vertex_properties = std::move(*src_vertex_properties);
|
||||
static constexpr bool kInEdges = true;
|
||||
static constexpr bool kOutEdges = false;
|
||||
if (!in_edges.empty()) {
|
||||
if (const auto fill_edges_res = FillEdges<kInEdges>(in_edges, result_row, edge_filler); fill_edges_res.HasError()) {
|
||||
return fill_edges_res.GetError();
|
||||
}
|
||||
if (const auto fill_edges_res = FillEdges<kInEdges>(in_edges, result_row, edge_filler); fill_edges_res.HasError()) {
|
||||
return fill_edges_res.GetError();
|
||||
}
|
||||
if (!out_edges.empty()) {
|
||||
if (const auto fill_edges_res = FillEdges<kOutEdges>(out_edges, result_row, edge_filler);
|
||||
fill_edges_res.HasError()) {
|
||||
return fill_edges_res.GetError();
|
||||
}
|
||||
if (const auto fill_edges_res = FillEdges<kOutEdges>(out_edges, result_row, edge_filler); fill_edges_res.HasError()) {
|
||||
return fill_edges_res.GetError();
|
||||
}
|
||||
|
||||
return result_row;
|
||||
@ -447,7 +442,6 @@ EdgeFiller InitializeEdgeFillerFunction(const msgs::ExpandOneRequest &req) {
|
||||
return {};
|
||||
};
|
||||
} else {
|
||||
// TODO(gvolfing) - do we want to set the action_successful here?
|
||||
edge_filler = [&req](const EdgeAccessor &edge, const bool is_in_edge,
|
||||
msgs::ExpandOneResultRow &result_row) -> ShardResult<void> {
|
||||
std::vector<msgs::Value> value_properties;
|
||||
@ -555,8 +549,6 @@ msgs::WriteResponses ShardRsm::ApplyWrite(msgs::DeleteVerticesRequest &&req) {
|
||||
auto vertex_acc = acc.FindVertex(ConvertPropertyVector(std::move(propval)), View::OLD);
|
||||
|
||||
if (!vertex_acc) {
|
||||
spdlog::debug("Error while trying to delete vertex. Vertex to delete does not exist. Transaction id: {}",
|
||||
req.transaction_id.logical_id);
|
||||
shard_error.emplace(msgs::ShardError{common::ErrorCode::OBJECT_NOT_FOUND});
|
||||
spdlog::debug("In transaction {} vertex could not be found while trying to delete it.",
|
||||
req.transaction_id.logical_id);
|
||||
|
@ -2657,7 +2657,7 @@ TEST_P(StorageV3, TestCreateVertexAndValidate) {
|
||||
|
||||
ASSERT_TRUE(vertex2.HasError());
|
||||
auto error = vertex2.GetError();
|
||||
ASSERT_TRUE(error.code == common::ErrorCode::VERTEX_ALREADY_INSERTED);
|
||||
ASSERT_TRUE(error == common::ErrorCode::VERTEX_ALREADY_INSERTED);
|
||||
}
|
||||
{
|
||||
auto acc = store.Access(GetNextHlc());
|
||||
|
Loading…
Reference in New Issue
Block a user