Throw exception not assert

This commit is contained in:
jbajic 2022-08-04 11:18:21 +02:00
parent 7c01957295
commit e36784b5e5

View File

@ -199,7 +199,9 @@ VertexAccessor &CreateLocalVertexAtomically(const NodeCreationInfo &node_info, F
}
}
// TODO Remove later on since that will be enforced from grammar side
MG_ASSERT(!node_info.labels.empty(), "There must be at least one label!");
if (node_info.labels.empty()) {
throw QueryRuntimeException("There must be a primary label defined.");
}
const auto primary_label = node_info.labels[0];
std::vector<storage::v3::LabelId> secondary_labels(node_info.labels.begin() + 1, node_info.labels.end());
auto maybe_new_node = dba.InsertVertexAndValidate(primary_label, secondary_labels, properties);