https://github.com/npdeehan/genericerrorandreturn
Showing how to throw an error anywhere in the process and then Return back afterwards
https://github.com/npdeehan/genericerrorandreturn
Last synced: 9 months ago
JSON representation
Showing how to throw an error anywhere in the process and then Return back afterwards
- Host: GitHub
- URL: https://github.com/npdeehan/genericerrorandreturn
- Owner: NPDeehan
- License: apache-2.0
- Created: 2019-12-06T10:43:17.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-12-06T10:53:42.000Z (over 6 years ago)
- Last Synced: 2025-04-15T23:16:59.030Z (about 1 year ago)
- Language: Java
- Size: 106 KB
- Stars: 9
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Generic Error And Return
This is an example in spring boot of how you can have a process throw an error at some point in the process. Then have a generic event subprocess deal with the error before returning to where the process left off.
![process-model]
you can start the process and each service will throw an error randomly. The error is thrown and the current activity id is added as a message to the error event.
```java
throw new BpmnError("GenericError", delegateExecution.getCurrentActivityId());
```
This is then stored in a variable that is accessed in order make the return. Which puts the token back the end of the symbol that threw the error
````java
delegateExecution.getProcessEngineServices().getRuntimeService()
.createProcessInstanceModification(delegateExecution.getProcessInstanceId())
.startAfterActivity(errorTaskId)
.execute();
````
[process-model]: ./src/main/resources/genericErrorAndReturn.png "Order Sorter Process Model"