User: usama@sartography.com clicked save for playground/usama/error-events/error-events.bpmn

This commit is contained in:
sartography-automated-committer 2024-02-29 14:27:08 +00:00
parent 53c502a0f3
commit 90a7281486

View File

@ -17,16 +17,20 @@ You can also change the text you are reading here by updating the *Instructions*
</bpmn:extensionElements>
<bpmn:incoming>Flow_17db3yp</bpmn:incoming>
<bpmn:outgoing>Flow_12n5xe2</bpmn:outgoing>
<bpmn:script>try:
# Python code that might fail
raise Exception("Sample error")
<bpmn:script>from org.camunda.bpm.engine.delegate import BpmnError
try:
# Your script logic here
# For example, attempting to open a non-existent file
with open('non_existent_file.txt', 'r') as file:
data = file.read()
except Exception as e:
error_data = {
"activity": "Script Task ID",
"errorMessage": str(e)
}
# Throwing BPMN error with details
raise BPMNError("ErrorBoundaryCode", json.dumps(error_data))
# Constructing error message
error_message = str(e)
# Throwing BPMN error with a specific error code and message
# "1001" is the error code, and error_message contains the exception details
raise BpmnError("1001", error_message)
</bpmn:script>
</bpmn:scriptTask>
<bpmn:sequenceFlow id="Flow_12n5xe2" sourceRef="Activity_0qpzdpu" targetRef="Activity_18bra6e" />