Work on error handling
[mkjsf-moved-to-github.git] / src / main / java / com / indexdata / pz2utils4jsf / pazpar2 / Pz2Session.java
index 886a0b8..3034a74 100644 (file)
@@ -18,7 +18,7 @@ import com.indexdata.masterkey.pazpar2.client.Pazpar2ClientGeneric;
 import com.indexdata.masterkey.pazpar2.client.exceptions.ProxyErrorException;\r
 import com.indexdata.pz2utils4jsf.config.Pz2Configurator;\r
 import com.indexdata.pz2utils4jsf.controls.ResultsPager;\r
-import com.indexdata.pz2utils4jsf.errors.ApplicationError;\r
+import com.indexdata.pz2utils4jsf.errors.ErrorInterface;\r
 import com.indexdata.pz2utils4jsf.errors.ErrorHelper;\r
 import com.indexdata.pz2utils4jsf.errors.ConfigurationError;\r
 import com.indexdata.pz2utils4jsf.pazpar2.data.CommandError;\r
@@ -48,7 +48,7 @@ public class Pz2Session implements Pz2Interface {
   private TargetFilter targetFilter = null;  \r
   private ResultsPager pager = null; \r
   private ErrorHelper errorHelper = null;\r
-  private List<ApplicationError> configurationErrors = null;\r
+  private List<ErrorInterface> configurationErrors = null;\r
   \r
   public Pz2Session () {\r
     logger.info("Instantiating pz2 session object [" + Utils.objectId(this) + "]");      \r
@@ -56,7 +56,7 @@ public class Pz2Session implements Pz2Interface {
     \r
   public void init(Pz2Configurator pz2conf) {\r
     if (client==null) {\r
-      configurationErrors = new ArrayList<ApplicationError>();\r
+      configurationErrors = new ArrayList<ErrorInterface>();\r
       errorHelper = new ErrorHelper(pz2conf);\r
       logger.info(Utils.objectId(this) + " is configuring itself using the provided " + Utils.objectId(pz2conf));\r
       try {\r
@@ -144,11 +144,7 @@ public class Pz2Session implements Pz2Interface {
         return "0";\r
       }\r
     } else {\r
-      configurationErrors.add(\r
-          new ConfigurationError("Querying while errors",\r
-                                 "App halted",\r
-                                 "Cannot query Pazpar2 while there are configuration errors.",\r
-                                 errorHelper));\r
+      logger.error("Did not attempt to execute query since there are configuration errors.");\r
       return "0";\r
     }\r
     \r
@@ -324,7 +320,7 @@ public class Pz2Session implements Pz2Interface {
     return hasConfigurationErrors() || hasCommandErrors();\r
   }\r
 \r
-  public List<ApplicationError> getConfigurationErrors() {    \r
+  public List<ErrorInterface> getConfigurationErrors() {    \r
     return configurationErrors;\r
   }\r
   \r
@@ -333,7 +329,7 @@ public class Pz2Session implements Pz2Interface {
    * error found for an arbitrary command, if any, otherwise\r
    * an empty dummy error. \r
    */    \r
-  public ApplicationError getCommandError() {\r
+  public ErrorInterface getCommandError() {\r
     CommandError error = new CommandError();    \r
     if (dataObjects.get("search").hasApplicationError()) {\r
       error = dataObjects.get("search").getApplicationError();                        \r