Gracefully handle errors in event-stream on the client side

Change-Id: Idd39c50d5b31894178f89b60ca822c18981f6e00
diff --git a/plugin/src/main/java/de/ids_mannheim/korap/plkexport/Service.java b/plugin/src/main/java/de/ids_mannheim/korap/plkexport/Service.java
index d8f3a0e..af935cf 100644
--- a/plugin/src/main/java/de/ids_mannheim/korap/plkexport/Service.java
+++ b/plugin/src/main/java/de/ids_mannheim/korap/plkexport/Service.java
@@ -60,7 +60,8 @@
  * TODO for release:
  * - Rename to "Kalamar-Plugin-Export".
  * - Remove 'plugin' root folder.
- * - Localize.
+ * - Localize RTF export.
+ *   - Change "count" to "number of results" in RTF.
  * - Delete the temp file of the export at the end
  *   of serving.
  * - Add date info.
@@ -68,7 +69,6 @@
  * - Improve Readme.
  * - 100 matches as default for export form.
  * - Test ExWsConf.
- * - Change "count" to "number of results" in RTF.
  *
  * TODO:
  * - Abort processing when eventsource is closed.
diff --git a/plugin/src/main/resources/assets/export.js b/plugin/src/main/resources/assets/export.js
index eef6ad0..65f10fd 100644
--- a/plugin/src/main/resources/assets/export.js
+++ b/plugin/src/main/resources/assets/export.js
@@ -22,6 +22,10 @@
           document.getElementById("cq").value=v["cq"];
         };
         document.getElementById("export-query").innerText = e;
+      }
+
+      else {
+        P.log(0, "Query undefined");
       };
 
       P.resize();
@@ -80,11 +84,16 @@
     prog.textualData = e.data + "%";
   });
 
-  sse.addEventListener('Error', function (e) {
+  const err = function (e) {
     prog.style.display = "none";
     sse.close();
+    window.Plugin.resize();
+    console.log(e.data);
     window.Plugin.log(0, e.data);
-  });
+  };
+
+  sse.addEventListener('Error', err);
+  sse.onerror = err;
 
   sse.addEventListener('Relocate', function (e) {
     if (e.data == undefined || e.data.length == 0) {
diff --git a/plugin/src/main/resources/assets/templates/export.ftl b/plugin/src/main/resources/assets/templates/export.ftl
index 0b23d0e..748a878 100644
--- a/plugin/src/main/resources/assets/templates/export.ftl
+++ b/plugin/src/main/resources/assets/templates/export.ftl
@@ -61,7 +61,7 @@
     </style>   
   </head>
   <body>
-    <div class="banner" data-note="${dict.banner}"></div>
+    <!-- <div class="banner" data-note="${dict.banner}"></div> -->
     <h1>${dict.export}: <code id="export-query"></code></h1>
     <section>
       <form id="export" class="form-table" action="export" method="POST">