arjunashok commented on code in PR #349:
URL: https://github.com/apache/cassandra-sidecar/pull/349#discussion_r3270446316


##########
server/src/main/java/org/apache/cassandra/sidecar/job/OperationalJob.java:
##########
@@ -256,6 +263,18 @@ public Future<Void> asyncResult()
         return executionPromise.future();
     }
 
+    @Override
+    @Nullable
+    public String failureReason()
+    {
+        Future<Void> fut = asyncResult();
+        if (fut.isComplete() && fut.failed() && fut.cause() != null)
+        {
+            return fut.cause().getMessage();

Review Comment:
   `getMessage()` can return null for exceptions created without a message 
(e.g. new RuntimeException()). The response would show a FAILED job with no 
reason.



##########
server/src/test/java/org/apache/cassandra/sidecar/handlers/OperationalJobHandlerTest.java:
##########
@@ -184,6 +184,7 @@ public OperationalJobManager jobManager()
             when(failedMock.jobId()).thenReturn(failedUuid);
             when(failedMock.status()).thenReturn(OperationalJobStatus.FAILED);
             
when(failedMock.asyncResult()).thenReturn(Future.failedFuture("Test failed"));

Review Comment:
   Nit. can be removed. `OperationalJobHandler` no longer calls asyncResult() 
on the job



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to