Skip to content

Commit

Permalink
fix: disallow error references without error code
Browse files Browse the repository at this point in the history
  • Loading branch information
philippfromme committed Mar 27, 2023
1 parent 6208d1d commit d4d4fc8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 21 deletions.
3 changes: 1 addition & 2 deletions rules/error-reference.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ module.exports = skipInNonExecutableProcess(function({ version }) {

errors = hasProperties(errorRef, {
errorCode: {
required: true,
allowedVersion: '8.2'
required: true
}
}, node);

Expand Down
23 changes: 4 additions & 19 deletions test/camunda-cloud/error-reference.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,6 @@ const valid = [
</bpmn:boundaryEvent>
`))
},
{
name: 'error boundary event (no error code) (Camunda 8.2)',
config: { version: '8.2' },
moddleElement: createModdle(createDefinitions(`
<bpmn:process id="Process_1">
<bpmn:task id="Task_1" />
<bpmn:boundaryEvent id="BoundaryEvent_1" attachedToRef="Task_1">
<bpmn:errorEventDefinition id="ErrorEventDefinition_1" errorRef="Error_1" />
</bpmn:boundaryEvent>
</bpmn:process>
<bpmn:error id="Error_1" />
`))
},
{
name: 'error end event (no error reference) (non-executable process)',
config: { version: '8.2' },
Expand Down Expand Up @@ -117,7 +104,7 @@ const invalid = [
`)),
report: {
id: 'EndEvent_1',
message: 'Element of type <bpmn:Error> without property <errorCode> only allowed by Camunda Platform 8.2 or newer',
message: 'Element of type <bpmn:Error> must have property <errorCode>',
path: [
'rootElements',
1,
Expand All @@ -127,8 +114,7 @@ const invalid = [
type: ERROR_TYPES.PROPERTY_REQUIRED,
node: 'Error_1',
parentNode: 'EndEvent_1',
requiredProperty: 'errorCode',
allowedVersion: '8.2'
requiredProperty: 'errorCode'
}
}
},
Expand Down Expand Up @@ -172,7 +158,7 @@ const invalid = [
`)),
report: {
id: 'BoundaryEvent_1',
message: 'Element of type <bpmn:Error> without property <errorCode> only allowed by Camunda Platform 8.2 or newer',
message: 'Element of type <bpmn:Error> must have property <errorCode>',
path: [
'rootElements',
1,
Expand All @@ -182,8 +168,7 @@ const invalid = [
type: ERROR_TYPES.PROPERTY_REQUIRED,
node: 'Error_1',
parentNode: 'BoundaryEvent_1',
requiredProperty: 'errorCode',
allowedVersion: '8.2'
requiredProperty: 'errorCode'
}
}
},
Expand Down

0 comments on commit d4d4fc8

Please sign in to comment.