mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 06:15:11 +00:00
fix(plugin-workflow): track error when instruction not exist (#5319)
This commit is contained in:
parent
06af42da5b
commit
d335ffee7f
@ -206,6 +206,9 @@ export default class Processor {
|
|||||||
public async run(node, input?) {
|
public async run(node, input?) {
|
||||||
const { instructions } = this.options.plugin;
|
const { instructions } = this.options.plugin;
|
||||||
const instruction = instructions.get(node.type);
|
const instruction = instructions.get(node.type);
|
||||||
|
if (!instruction) {
|
||||||
|
return Promise.reject(new Error(`instruction [${node.type}] not found for node (#${node.id})`));
|
||||||
|
}
|
||||||
if (typeof instruction.run !== 'function') {
|
if (typeof instruction.run !== 'function') {
|
||||||
return Promise.reject(new Error('`run` should be implemented for customized execution of the node'));
|
return Promise.reject(new Error('`run` should be implemented for customized execution of the node'));
|
||||||
}
|
}
|
||||||
@ -232,6 +235,9 @@ export default class Processor {
|
|||||||
private async recall(node, job) {
|
private async recall(node, job) {
|
||||||
const { instructions } = this.options.plugin;
|
const { instructions } = this.options.plugin;
|
||||||
const instruction = instructions.get(node.type);
|
const instruction = instructions.get(node.type);
|
||||||
|
if (!instruction) {
|
||||||
|
return Promise.reject(new Error(`instruction [${node.type}] not found for node (#${node.id})`));
|
||||||
|
}
|
||||||
if (typeof instruction.resume !== 'function') {
|
if (typeof instruction.resume !== 'function') {
|
||||||
return Promise.reject(
|
return Promise.reject(
|
||||||
new Error(`"resume" method should be implemented for [${node.type}] instruction of node (#${node.id})`),
|
new Error(`"resume" method should be implemented for [${node.type}] instruction of node (#${node.id})`),
|
||||||
|
Loading…
Reference in New Issue
Block a user