Skip to content

Commit e368709

Browse files
authored
fix: handle all exceptions to support Kotlin (#2965)
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 6c844bc commit e368709

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,9 @@ protected void markAsExecuting(
111111
actualExecutions.put(dependentResourceNode, future);
112112
}
113113

114+
// Exception is required because of Kotlin
114115
protected synchronized void handleExceptionInExecutor(
115-
DependentResourceNode<?, P> dependentResourceNode, RuntimeException e) {
116+
DependentResourceNode<?, P> dependentResourceNode, Exception e) {
116117
createOrGetResultFor(dependentResourceNode).withError(e);
117118
}
118119

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)