Error Handling #220
-
Hi @ralphhanna Reagrding error handling, consider the below example: For testing, I have the below service: async ErrorHandleTest(input, context) {
if (Math.random() < 0.1) {
return { bpmnError: 'Something wrong' }; // my required ERROR message
} else {
// no error
return;
}
} Where is that error and its message stored and how to access it? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Not anywhere, but if the error handler is error specific it can store it anywhere. Any suggestions? One possible change: async processError(errorCode,callingEvent) {
let errorHandlerToken = this.getScopeCatchEvent('error',errorCode);
if (errorHandlerToken) {
await errorHandlerToken.signal(null);
this.currentItem.status = ITEM_STATUS.end;
await this.end(true);
}
else {
this.log("Aborting due to error");
await this.execution.terminate();
return;
}
} Code After: async processError(errorCode,callingEvent) {
let errorHandlerToken = this.getScopeCatchEvent('error',errorCode);
if (errorHandlerToken) {
await errorHandlerToken.signal(errorCode);
this.currentItem.status = ITEM_STATUS.end;
await this.end(true);
}
else {
this.log("Aborting due to bpmnError",errorCode)
await appDelegate.bpmnError(errorCode,execution); //this.execution.terminate();
return;
}
}
|
Beta Was this translation helpful? Give feedback.
-
Wouldn't it better if the error message/code is automatically stored in the catch event (probably This would be helpful to see what went wrong when coming back to that item. what do you think? |
Beta Was this translation helpful? Give feedback.
-
@MaheshkumarSundaram Please check new release 2.2.10 Thanks |
Beta Was this translation helpful? Give feedback.
@MaheshkumarSundaram
Hi, After long thoughts, I have added a new variable
item.statusDetails
that contains and object with bpmnError information.Please check new release 2.2.10
Thanks