mirror of
https://github.com/sartography/bpmn-js.git
synced 2025-01-11 17:44:12 +00:00
chore(ordering): throw on missing order
Throw a proper exception of we fail to compute an elements ordering.
This commit is contained in:
parent
9cb2fa123d
commit
5f266b20df
@ -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) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user