JAL-3954 Report error log when job fails
authorMateusz Warowny <mmzwarowny@dundee.ac.uk>
Fri, 2 Jun 2023 13:07:50 +0000 (15:07 +0200)
committerMateusz Warowny <mmzwarowny@dundee.ac.uk>
Fri, 2 Jun 2023 13:16:47 +0000 (15:16 +0200)
src/jalview/ws2/client/ebi/PhmmerWSClient.java

index 9c5f14f..380e8e6 100644 (file)
@@ -1,6 +1,7 @@
 package jalview.ws2.client.ebi;
 
 import java.io.BufferedReader;
+import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
@@ -231,7 +232,14 @@ public class PhmmerWSClient implements AlignmentWebServiceClientI
   @Override
   public String getErrorLog(WebServiceJobHandle job) throws IOException
   {
-    return "";
+    if (getStatus(job) != JobStatus.FAILED)
+      return "";
+    try(InputStream stream = client.getResultStream(job.getJobId(), "error"))
+    {
+      ByteArrayOutputStream out = new ByteArrayOutputStream();
+      stream.transferTo(out);
+      return out.toString();
+    }
   }
 
   @Override