@@ -163,14 +163,12 @@ class ClassHelper extends HTMLElement {
163163 . catch ( error => {
164164 // Top level error handling for openPopUp method.
165165 cleanUpClosure ( ) ;
166-
166+ console . error ( error ) ;
167167 if ( this . popupRef != null ) {
168- const fragment = this . getErrorFragment ( "An error occurred while opening the popup window" ) ;
169- this . popupRef . document . body . innerHTML = ""
170- this . popupRef . document . body . appendChild ( fragment ) ;
168+ this . popupRef . close ( ) ;
171169 }
172-
173- console . error ( error ) ;
170+ window . alert ( "Error: Failed to open classhelper, check console for more details." ) ;
171+ this . helpurl . click ( ) ;
174172 } ) ;
175173 } ;
176174
@@ -179,11 +177,12 @@ class ClassHelper extends HTMLElement {
179177 . catch ( error => {
180178 // Top level error handling for nextPage method.
181179 cleanUpClosure ( ) ;
182- const fragment = this . getErrorFragment ( "An error occurred while fetching the next page of table" ) ;
183- this . popupRef . document . body . innerHTML = ""
184- this . popupRef . document . body . appendChild ( fragment ) ;
185-
186180 console . error ( error , `request data url: ${ event . detail . value } ` ) ;
181+ if ( this . popupRef != null ) {
182+ this . popupRef . close ( ) ;
183+ }
184+ window . alert ( "Error: Failed to load next page, check console for more details." ) ;
185+ this . helpurl . click ( ) ;
187186 } ) ;
188187 }
189188
@@ -192,11 +191,12 @@ class ClassHelper extends HTMLElement {
192191 . catch ( error => {
193192 // Top level error handling for prevPage method.
194193 cleanUpClosure ( ) ;
195- const fragment = this . getErrorFragment ( "An error occurred while fetching the previous page of table" ) ;
196- this . popupRef . document . body . innerHTML = ""
197- this . popupRef . document . body . appendChild ( fragment ) ;
198-
199194 console . error ( error , `request data url: ${ event . detail . value } ` ) ;
195+ if ( this . popupRef != null ) {
196+ this . popupRef . close ( ) ;
197+ }
198+ window . alert ( "Error: Failed to load next page, check console for more details." ) ;
199+ this . helpurl . click ( ) ;
200200 } ) ;
201201 }
202202
@@ -212,11 +212,12 @@ class ClassHelper extends HTMLElement {
212212 . catch ( error => {
213213 // Top level error handling for searchEvent method.
214214 cleanUpClosure ( ) ;
215- const fragment = this . getErrorFragment ( "An error occurred while fetching the search results" ) ;
216- this . popupRef . document . body . innerHTML = ""
217- this . popupRef . document . body . appendChild ( fragment ) ;
218-
219215 console . error ( error , `request data url: ${ event . detail . value } ` ) ;
216+ if ( this . popupRef != null ) {
217+ this . popupRef . close ( ) ;
218+ }
219+ window . alert ( "Error: Failed to load next page, check console for more details." ) ;
220+ this . helpurl . click ( ) ;
220221 } ) ;
221222 }
222223
@@ -475,32 +476,6 @@ class ClassHelper extends HTMLElement {
475476 return url ;
476477 }
477478
478- getErrorFragment ( message ) {
479- const fragment = document . createDocumentFragment ( ) ;
480- const div = document . createElement ( "div" ) ;
481- div . classList . add ( "error-div" ) ;
482- const h3_1 = document . createElement ( "h3" ) ;
483- h3_1 . textContent = message ;
484- const h3_2 = document . createElement ( "h3" ) ;
485- h3_2 . textContent = "Classhelper will not intercept helpurl link." ;
486- const h3_3 = document . createElement ( "h3" ) ;
487- h3_3 . textContent = "Using fallback helpurl instead." ;
488- const h3_4 = document . createElement ( "h3" ) ;
489- h3_4 . textContent = "Please check the console for more details." ;
490-
491- const button = document . createElement ( "button" ) ;
492- button . textContent = "Close Popup" ;
493-
494- button . addEventListener ( "click" , ( ) => {
495- this . popupRef . close ( ) ;
496- } ) ;
497-
498- div . append ( h3_1 , h3_2 , h3_3 , h3_4 , button ) ;
499- fragment . appendChild ( div ) ;
500-
501- return fragment ;
502- }
503-
504479 getSearchFragment ( formData ) {
505480 const fragment = document . createDocumentFragment ( ) ;
506481 const form = document . createElement ( "form" ) ;
@@ -783,6 +758,7 @@ class ClassHelper extends HTMLElement {
783758 tr . children . item ( 0 ) . checked = ! tr . children . item ( 0 ) . checked ;
784759 }
785760
761+ this . popupRef . document . activeElement . blur ( ) ;
786762 this . dispatchEvent ( new CustomEvent ( "selection" , {
787763 detail : {
788764 value : id
0 commit comments