More informative error messages.
authorjprocter <Jim Procter>
Mon, 5 Sep 2005 15:38:26 +0000 (15:38 +0000)
committerjprocter <Jim Procter>
Mon, 5 Sep 2005 15:38:26 +0000 (15:38 +0000)
src/jalview/ws/JPredClient.java

index 65f0325..4302df2 100755 (executable)
@@ -249,15 +249,15 @@ public class JPredClient
           }\r
         }\r
       }\r
-\r
-      if (! (result.isJobFailed() || result.isServerError()))\r
-      {\r
-        wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_OK);\r
-      }\r
-      else\r
-      {\r
-        wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR);\r
-      }\r
+      if (result!=null)\r
+        if (! (result.isJobFailed() || result.isServerError()))\r
+        {\r
+          wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_OK);\r
+        }\r
+        else\r
+        {\r
+          wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR);\r
+        }\r
     }\r
 \r
     void StartJob()\r
@@ -292,16 +292,17 @@ public class JPredClient
       catch (Exception e)\r
       {\r
         wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR);\r
-        allowedServerExceptions = 0;\r
-        jobComplete = false;\r
-\r
-        wsInfo.appendProgressText("Failed to submit the prediction.\n"\r
-                                  +\r
-                                  "It is most likely that there is a problem with the server.\n"\r
-                                  + "Just close the window\n");\r
+        allowedServerExceptions = -1;\r
+        jobComplete = true;\r
+\r
+        wsInfo.setProgressText("Failed to submit the prediction. (Just close the window)\n"\r
+                                  + ((e.getMessage().indexOf("Exception")>-1) ? (\r
+                                  "It is most likely that there is a problem with the server.\n")\r
+                              : e.getMessage())\r
+                                  +wsInfo.getProgressText());\r
         System.err.println(\r
-            "JPredWS Client: Failed to submit the prediction (Probably a server error - see below)\n" +\r
-            e.toString() + "\n");\r
+            "JPredWS Client: Failed to submit the prediction (Possibly a server error - see below)\n" +\r
+            e.getMessage() + "\n");\r
 \r
         jalview.bin.Jalview.log.debug("Failed Submission",e);\r
       }\r