error message associated with an alignment file loading failure is passed back to...
[jalview.git] / src / jalview / io / FileParse.java
index f4f765c..8a97e39 100755 (executable)
@@ -128,6 +128,7 @@ public class FileParse
     else if (type.equals(AppletFormatAdapter.URL))
     {
       try {
+      try {
         checkURLSource(fileStr);
         if (suffixSeparator=='#')
           extractSuffix(fileStr); // URL lref is stored for later reference.
@@ -146,6 +147,12 @@ public class FileParse
           }
         }
       }
+      }
+      catch (Exception e)
+      {
+        errormessage = "CANNOT ACCESS DATA AT URL '"+fileStr+"' ("+e.getMessage()+")";
+        error=true;
+      }
     }
     else if (type.equals(AppletFormatAdapter.PASTE))
     {
@@ -168,6 +175,11 @@ public class FileParse
         error = true;
       }
     }
+    if (dataIn==null)
+    {
+      // pass up the reason why we have no source to read from
+      throw new IOException("Failed to read data from source:\n"+errormessage);
+    }
     error=false;
     dataIn.mark(READAHEAD_LIMIT);
   }