fix(plugin-workflow): defend unimplemented trigger type (#3263)
This commit is contained in:
parent
28759aac07
commit
b68fde9d47
@ -235,6 +235,10 @@ export default class WorkflowPlugin extends Plugin {
|
|||||||
toggle(workflow: WorkflowModel, enable?: boolean) {
|
toggle(workflow: WorkflowModel, enable?: boolean) {
|
||||||
const type = workflow.get('type');
|
const type = workflow.get('type');
|
||||||
const trigger = this.triggers.get(type);
|
const trigger = this.triggers.get(type);
|
||||||
|
if (!trigger) {
|
||||||
|
this.getLogger(workflow.id).error(`trigger type ${workflow.type} of workflow ${workflow.id} is not implemented`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (typeof enable !== 'undefined' ? enable : workflow.get('enabled')) {
|
if (typeof enable !== 'undefined' ? enable : workflow.get('enabled')) {
|
||||||
// NOTE: remove previous listener if config updated
|
// NOTE: remove previous listener if config updated
|
||||||
const prev = workflow.previous();
|
const prev = workflow.previous();
|
||||||
|
Loading…
Reference in New Issue
Block a user