chore(ordering): throw on missing order

Throw a proper exception of we fail to compute an elements ordering.
This commit is contained in:
Nico Rehwaldt 2021-06-22 14:58:52 +02:00 committed by Philipp Fromme
parent 9cb2fa123d
commit 5f266b20df

View File

@ -99,6 +99,10 @@ export default function BpmnOrderingProvider(eventBus, canvas, translate) {
element.order = order = computeOrder(element); element.order = order = computeOrder(element);
} }
if (!order) {
throw new Error('no order for <' + element.id + '>');
}
return order; return order;
} }
@ -116,10 +120,7 @@ export default function BpmnOrderingProvider(eventBus, canvas, translate) {
} }
if (!actualParent) { if (!actualParent) {
throw new Error(translate('no parent for {element} in {parent}', { throw new Error('no parent for <' + element.id + '> in <' + newParent.id + '>');
element: element.id,
parent: newParent.id
}));
} }
return actualParent; return actualParent;
@ -137,12 +138,10 @@ export default function BpmnOrderingProvider(eventBus, canvas, translate) {
var elementOrder = getOrder(element); var elementOrder = getOrder(element);
if (elementOrder.containers) { if (elementOrder.containers) {
newParent = findActualParent(element, newParent, elementOrder.containers); newParent = findActualParent(element, newParent, elementOrder.containers);
} }
var currentIndex = newParent.children.indexOf(element); var currentIndex = newParent.children.indexOf(element);
var insertIndex = findIndex(newParent.children, function(child) { var insertIndex = findIndex(newParent.children, function(child) {