Skip to content

Commit 9b0bb8b

Browse files
committed
fix: handle all exceptions to support Kotlin
Handle Exception and not just RuntimeException to support Kotlin and probably other JVM languages which do not have the concept of checked exceptions.
1 parent 7397be6 commit 9b0bb8b

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/dependent/workflow/AbstractWorkflowExecutor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ protected void markAsExecuting(
112112
}
113113

114114
protected synchronized void handleExceptionInExecutor(
115-
DependentResourceNode<?, P> dependentResourceNode, RuntimeException e) {
115+
DependentResourceNode<?, P> dependentResourceNode, Exception e) {
116116
createOrGetResultFor(dependentResourceNode).withError(e);
117117
}
118118

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/dependent/workflow/NodeExecutor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ public void run() {
1919
try {
2020
doRun(dependentResourceNode);
2121

22-
} catch (RuntimeException e) {
22+
} catch (Exception e) {
23+
// Exception is required because of Kotlin
2324
workflowExecutor.handleExceptionInExecutor(dependentResourceNode, e);
2425
} finally {
2526
workflowExecutor.handleNodeExecutionFinish(dependentResourceNode);

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/polling/PollingEventSource.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ public void run() {
7373
}
7474
getStateAndFillCache();
7575
healthy.set(true);
76-
} catch (RuntimeException e) {
76+
} catch (Exception e) {
77+
// Exception is required because of Kotlin
7778
healthy.set(false);
7879
log.error("Error during polling.", e);
7980
}

0 commit comments

Comments
 (0)