]> git.wh0rd.org - tt-rss.git/blobdiff - js/functions.js
Merge branch 'hookhead' of git://github.com/justauserx/Tiny-Tiny-RSS into justauserx...
[tt-rss.git] / js / functions.js
index 04be58bf77a2961b7dd2ef3afe29f013fad080eb..b9b3aa44e1e110c768bf3719cd098916cfa63ada 100644 (file)
@@ -50,6 +50,21 @@ function exception_error(location, e, ext_info) {
                        }
                }
 
+               try {
+                       new Ajax.Request("backend.php", {
+                               parameters: {op: "rpc", method: "log", logmsg: msg},
+                               onComplete: function (transport) {
+                                       console.log(transport.responseText);
+                               } });
+
+               } catch (eii) {
+                       console.log("Exception while trying to log the error.");
+                       console.log(eii);
+               }
+
+               msg += "<p>"+ __("The error will be reported to the configured log destination.") +
+                       "</p>";
+
                var content = "<div class=\"fatalError\">" +
                        "<pre>" + msg + "</pre>";
 
@@ -106,7 +121,28 @@ function exception_error(location, e, ext_info) {
 
                dialog.show();
 
-       } catch (e) {
+       } catch (ei) {
+               console.log("Exception while trying to report an exception. Oh boy.");
+               console.log(ei);
+               console.log("Original exception:");
+               console.log(e);
+
+               msg += "\n\nAdditional exception caught while trying to show the error dialog.\n\n" +  format_exception_error('exception_error', ei);
+
+               try {
+                       new Ajax.Request("backend.php", {
+                               parameters: {op: "rpc", method: "log", logmsg: msg},
+                               onComplete: function (transport) {
+                                       console.log(transport.responseText);
+                               } });
+
+               } catch (eii) {
+                       console.log("Third exception while trying to log the error! Seriously?");
+                       console.log(eii);
+               }
+
+               msg += "\n\nThe error will be reported to the configured log destination.";
+
                alert(msg);
        }
 
@@ -196,7 +232,7 @@ function notify_real(msg, no_hide, n_type) {
                msg = "<span><img src='images/sign_info.svg'></span>" + msg;
        }
 
-       msg += " <span><img src=\"images/close_notify.svg\" class=\"close\" title=\"" +
+       msg += " <span><img src=\"images/cross.png\" class=\"close\" title=\"" +
                __("Click to close") + "\" onclick=\"notify('')\"></span>";
 
 //     msg = "<img src='images/live_com_loading.gif'> " + msg;
@@ -1233,16 +1269,17 @@ function backend_sanity_check_callback(transport) {
                if (params) {
                        console.log('reading init-params...');
 
-                       if (params) {
-                               for (k in params) {
-                                       var v = params[k];
-                                       console.log("IP: " + k + " => " + v);
+                       for (k in params) {
+                               var v = params[k];
+                               console.log("IP: " + k + " => " + v);
 
-                                       if (k == "label_base_index") _label_base_index = parseInt(v);
-                               }
+                               if (k == "label_base_index") _label_base_index = parseInt(v);
                        }
 
                        init_params = params;
+
+                       // PluginHost might not be available on non-index pages
+                       window.PluginHost && PluginHost.run(PluginHost.HOOK_PARAMS_LOADED, init_params);
                }
 
                sanity_check_done = true;