mirror of
https://github.com/bpmn-io/bpmn-js.git
synced 2025-08-14 11:11:14 +08:00
chore: throw error when accessing DI from business object
Related to https://github.com/bpmn-io/bpmn-js/issues/1472
This commit is contained in:

committed by
Nico Rehwaldt

parent
0c40cbe9f3
commit
597c417dce
@ -1,4 +1,7 @@
|
||||
import { isFunction } from 'min-dash';
|
||||
import {
|
||||
has,
|
||||
isFunction
|
||||
} from 'min-dash';
|
||||
|
||||
// TODO(nikku): remove with future bpmn-js version
|
||||
|
||||
@ -51,3 +54,20 @@ export function wrapForCompatibility(api) {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// TODO(nikku): remove with future bpmn-js version
|
||||
|
||||
var DI_ERROR_MESSAGE = 'Tried to access di from the businessObject. The di is available through the diagram element only. For more information, see https://github.com/bpmn-io/bpmn-js/issues/1472';
|
||||
|
||||
export function ensureCompatDiRef(businessObject) {
|
||||
|
||||
// bpmnElement can have multiple independent DIs
|
||||
if (!has(businessObject, 'di')) {
|
||||
Object.defineProperty(businessObject, 'di', {
|
||||
get: function() {
|
||||
throw new Error(DI_ERROR_MESSAGE);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user