This is an automated email from the ASF dual-hosted git repository.
fjtiradosarti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-drools.git
The following commit(s) were added to refs/heads/main by this push:
new 7dd1a0f41d [Fix apache/incubator-kie-issues#987] Add onError listener
(#5766)
7dd1a0f41d is described below
commit 7dd1a0f41d1c9290d6cd3cb9031db02c26abf8a9
Author: Francisco Javier Tirado Sarti
<[email protected]>
AuthorDate: Thu Mar 7 10:44:42 2024 +0100
[Fix apache/incubator-kie-issues#987] Add onError listener (#5766)
---
.../java/org/kie/api/event/process/ErrorEvent.java | 33 ++++++++++++++++++++++
.../api/event/process/ProcessEventListener.java | 6 ++++
2 files changed, 39 insertions(+)
diff --git a/kie-api/src/main/java/org/kie/api/event/process/ErrorEvent.java
b/kie-api/src/main/java/org/kie/api/event/process/ErrorEvent.java
new file mode 100644
index 0000000000..af2cc4e056
--- /dev/null
+++ b/kie-api/src/main/java/org/kie/api/event/process/ErrorEvent.java
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.kie.api.event.process;
+
+import org.kie.api.runtime.process.NodeInstance;
+
+/**
+ * An event when a error is thrown
+ */
+public interface ErrorEvent extends ProcessNodeEvent {
+ /**
+ * Error associated to the event
+ *
+ * @return exception
+ */
+ Exception getException();
+}
diff --git
a/kie-api/src/main/java/org/kie/api/event/process/ProcessEventListener.java
b/kie-api/src/main/java/org/kie/api/event/process/ProcessEventListener.java
index 4f27158b6b..085f7a34a3 100644
--- a/kie-api/src/main/java/org/kie/api/event/process/ProcessEventListener.java
+++ b/kie-api/src/main/java/org/kie/api/event/process/ProcessEventListener.java
@@ -116,4 +116,10 @@ public interface ProcessEventListener
* @param event
*/
default void onMessage(MessageEvent event) {}
+
+ /**
+ * This listener method is invoked when an error is captured
+ * @param event
+ */
+ default void onError (ErrorEvent event) {}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]