Skip to content

Commit 45c7c40

Browse files
authored
TaskListener#onFailure to accept Exception instead of Throwable (#44946)
TaskListener accepts today Throwable in its onFailure method. Though looking at where it is called (TransportAction), it can never be notified of a Throwable. This commit changes the signature of TaskListener#onFailure so that it accepts an `Exception` rather than a `Throwable` as second argument.
1 parent 3be9a3b commit 45c7c40

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

server/src/main/java/org/elasticsearch/tasks/LoggingTaskListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void onResponse(Task task, Response response) {
4949
}
5050

5151
@Override
52-
public void onFailure(Task task, Throwable e) {
52+
public void onFailure(Task task, Exception e) {
5353
logger.warn(() -> new ParameterizedMessage("{} failed with exception", task.getId()), e);
5454
}
5555
}

server/src/main/java/org/elasticsearch/tasks/TaskListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ public interface TaskListener<Response> {
4444
* @param e
4545
* the failure
4646
*/
47-
void onFailure(Task task, Throwable e);
47+
void onFailure(Task task, Exception e);
4848

4949
}

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteJobAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ private static <T> TaskListener<T> nullTaskListener() {
7979
public void onResponse(Task task, T o) {}
8080

8181
@Override
82-
public void onFailure(Task task, Throwable e) {}
82+
public void onFailure(Task task, Exception e) {}
8383
};
8484
}
8585
}

0 commit comments

Comments
 (0)