new style exception reporting

This commit is contained in:
Andrew Dolgov 2009-01-23 18:19:17 +01:00
parent e8a429e3f8
commit 273d1e293e
6 changed files with 103 additions and 123 deletions

View File

@ -16,16 +16,19 @@ function is_opera() {
return window.opera; return window.opera;
} }
function exception_error_ext(location, e, ext_info) { function exception_error(location, e, ext_info) {
var msg = format_exception_error(location, e); var msg = format_exception_error(location, e);
var ebc = document.getElementById("xebContent");
disableHotkeys(); disableHotkeys();
try {
var ebc = document.getElementById("xebContent");
if (ebc) { if (ebc) {
Element.show("dialog_overlay"); Element.show("dialog_overlay");
Element.show("extendedErrorBox"); Element.show("errorBoxShadow");
if (ext_info) { if (ext_info) {
if (ext_info.responseText) { if (ext_info.responseText) {
@ -42,14 +45,12 @@ function exception_error_ext(location, e, ext_info) {
} else { } else {
alert(msg); alert(msg);
} }
}
function exception_error(location, e, silent) { } catch (e) {
var msg = format_exception_error(location, e);
if (!silent) {
alert(msg); alert(msg);
} }
} }
function format_exception_error(location, e) { function format_exception_error(location, e) {
@ -647,7 +648,7 @@ function all_counters_callback2(transport, async_call) {
debug("<b>all_counters_callback2 OUT: " + transport + "</b>"); debug("<b>all_counters_callback2 OUT: " + transport + "</b>");
} catch (e) { } catch (e) {
exception_error("all_counters_callback2", e); exception_error("all_counters_callback2", e, transport);
} }
} }
@ -655,7 +656,6 @@ function get_feed_unread(id) {
try { try {
return parseInt(document.getElementById("FEEDU-" + id).innerHTML); return parseInt(document.getElementById("FEEDU-" + id).innerHTML);
} catch (e) { } catch (e) {
exception_error("get_feed_unread", e, true);
return -1; return -1;
} }
} }
@ -667,7 +667,6 @@ function get_cat_unread(id) {
ctr = ctr.replace(")", ""); ctr = ctr.replace(")", "");
return parseInt(ctr); return parseInt(ctr);
} catch (e) { } catch (e) {
exception_error("get_feed_unread", e, true);
return -1; return -1;
} }
} }
@ -1280,10 +1279,9 @@ function leading_zero(p) {
function closeErrorBox() { function closeErrorBox() {
if (Element.visible("extendedErrorBox")) { if (Element.visible("errorBoxShadow")) {
Element.hide("dialog_overlay"); Element.hide("dialog_overlay");
Element.hide("errorBoxShadow");
Element.hide("extendedErrorBox");
enableHotkeys(); enableHotkeys();
} }
@ -1507,7 +1505,7 @@ function storeInitParam(key, value) {
init_params[key] = value; init_params[key] = value;
} }
function fatalError(code, message) { function fatalError(code, msg, ext_info) {
try { try {
if (code == 6) { if (code == 6) {
@ -1515,14 +1513,29 @@ function fatalError(code, message) {
} else if (code == 5) { } else if (code == 5) {
window.location.href = "update.php"; window.location.href = "update.php";
} else { } else {
var fe = document.getElementById("fatal_error");
var fc = document.getElementById("fatal_error_msg");
if (message == "") message = "Unknown error"; if (msg == "") msg = "Unknown error";
fc.innerHTML = "<img src='images/sign_excl.gif'> " + message + " (Code " + code + ")"; var ebc = document.getElementById("xebContent");
fe.style.display = "block"; if (ebc) {
Element.show("dialog_overlay");
Element.show("errorBoxShadow");
Element.hide("xebBtn");
if (ext_info) {
if (ext_info.responseText) {
ext_info = ext_info.responseText;
}
}
ebc.innerHTML =
"<div><b>Error message:</b></div>" +
"<pre>" + msg + "</pre>" +
"<div><b>Additional information:</b></div>" +
"<textarea readonly=\"1\">" + ext_info + "</textarea>";
}
} }
} catch (e) { } catch (e) {

View File

@ -78,7 +78,6 @@
</div> </div>
</div> </div>
<div id="hotkey_help_overlay" style="display : none" onclick="Element.hide(this)"> <div id="hotkey_help_overlay" style="display : none" onclick="Element.hide(this)">
<?php rounded_table_start("hho"); ?> <?php rounded_table_start("hho"); ?>
<?php include "help/4.php" ?> <?php include "help/4.php" ?>
@ -96,11 +95,6 @@ window.onload = init;
<ul id="debug_output" style='display : none'><li>&nbsp;</li></ul> <ul id="debug_output" style='display : none'><li>&nbsp;</li></ul>
<div id="fatal_error"><div id="fatal_error_inner">
<h1>Fatal Error</h1>
<div id="fatal_error_msg"><?php echo __('Unknown Error') ?></div>
</div></div>
<div id="prefHeader"> <div id="prefHeader">
<div class="topLinks"> <div class="topLinks">
<?php if (!SINGLE_USER_MODE) { ?> <?php if (!SINGLE_USER_MODE) { ?>
@ -160,6 +154,14 @@ window.onload = init;
<div id="notify" class="notify"><span id="notify_body">&nbsp;</span></div> <div id="notify" class="notify"><span id="notify_body">&nbsp;</span></div>
<div id="infoBoxShadow"><div id="infoBox">BAH</div></div> <div id="infoBoxShadow"><div id="infoBox">BAH</div></div>
<div id="errorBoxShadow" style="display : none">
<div id="errorBox">
<div id="xebTitle">Fatal Exception</div><div id="xebContent">&nbsp;</div>
<div id="xebBtn" align='center'><input type="submit"
onclick="closeErrorBox()" value="Close this window"/></div>
</div>
</div>
<div id="dialog_overlay" style="display : none"> </div> <div id="dialog_overlay" style="display : none"> </div>
<div id="prefFooter"> <div id="prefFooter">

View File

@ -567,13 +567,25 @@ div.helpResponse {
top : -4px; top : -4px;
} }
html>body #infoBox { div#errorBox {
background-color : #ffcccc;
border : 1px solid #ff0000;
font-size : 12px;
position: relative;
overflow : hidden;
left : -4px;
top : -4px;
}
html>body #infoBox, html>body #errorBox {
left : -10px; left : -10px;
top : -10px; top : -10px;
margin : 0; margin : 0;
} }
#infoBoxShadow:before, #infoBoxShadow:after { #infoBoxShadow:before, #infoBoxShadow:after,
#errorBoxShadow:before, #errorBoxShadow:after {
content : " "; content : " ";
display : block; display : block;
background : inherit; background : inherit;
@ -581,7 +593,7 @@ html>body #infoBox {
height : 10px; height : 10px;
} }
#infoBoxShadow:before { #infoBoxShadow:before, #errorBoxShadow:before {
position : absolute; position : absolute;
top : 0; top : 0;
right : 0; right : 0;
@ -589,24 +601,30 @@ html>body #infoBox {
background-position : right top; background-position : right top;
} }
#infoBoxShadow:after { #infoBoxShadow:after, #errorBoxShadow:after {
margin : -10px 0 0 -10px; margin : -10px 0 0 -10px;
background-position : left bottom; background-position : left bottom;
} }
#infoBoxShadow { #infoBoxShadow, #errorBoxShadow {
background-image : url("images/shadow.png"); background-image : url("images/shadow.png");
background-position : bottom right; background-position : bottom right;
left : 25%; left : 25%;
top : 70px; top : 70px;
width : 50%; width : 50%;
z-index : 5;
position : absolute; position : absolute;
display : none;
min-width : 600px; min-width : 600px;
} }
#infoBoxShadow {
z-index : 5;
}
#errorBoxShadow {
z-index : 400;
}
div.infoBoxContents { div.infoBoxContents {
padding : 10px; padding : 10px;
margin-bottom : 5px; margin-bottom : 5px;
@ -1328,44 +1346,6 @@ a.cdmToggleLink:hover {
margin : 10px; margin : 10px;
} }
#fatal_error {
background : white;
left : 0;
top : 0;
height : 100%;
width : 100%;
z-index : 200;
display : none;
position : absolute;
}
#fatal_error_inner {
font-weight : bold;
margin : 10px;
color : red;
}
#fatal_error_msg {
color : black;
padding : 10px;
font-weight : normal;
background-color : #ffcccc;
border : 1px solid #ff0000;
}
#fatal_error_msg a {
color : red;
}
#fatal_error_msg a:hover {
color : red;
text-decoration : underline;
}
#fatal_error_msg img {
vertical-align : middle;
}
#noDaemonWarning { #noDaemonWarning {
position : absolute; position : absolute;
background-color : #ecf4ff; background-color : #ecf4ff;
@ -2084,19 +2064,7 @@ ul#headlineActionsBody li.insensitive:hover {
color : gray; color : gray;
} }
div#extendedErrorBox { div#errorBox div#xebTitle {
left : 25%;
top : 70px;
width : 50%;
z-index : 999;
position : absolute;
min-width : 600px;
background-color : #ffcccc;
border : 1px solid #ff0000;
font-size : 12px;
}
div#extendedErrorBox div#xebTitle {
background-color : #ff0000; background-color : #ff0000;
color : white; color : white;
padding : 4px 2px 4px 10px; padding : 4px 2px 4px 10px;
@ -2105,16 +2073,18 @@ div#extendedErrorBox div#xebTitle {
font-size : 12px; font-size : 12px;
} }
div#extendedErrorBox div#xebContent { div#errorBox div#xebContent {
font-size : 12px; font-size : 12px;
padding : 10px; padding : 10px;
} }
div#extendedErrorBox textarea { div#errorBox textarea {
width : 100%; width : 100%;
height : 200px; height : 200px;
} }
div#extendedErrorBox input { div#errorBox input {
margin-bottom : 10px; margin-bottom : 10px;
} }

View File

@ -131,14 +131,14 @@ function backend_sanity_check_callback(transport) {
} }
if (!transport.responseXML) { if (!transport.responseXML) {
fatalError(3, "[D001, Received reply is not XML]: " + transport.responseText); fatalError(3, "Sanity check: Received reply is not XML", transport.responseText);
return; return;
} }
var reply = transport.responseXML.firstChild.firstChild; var reply = transport.responseXML.firstChild.firstChild;
if (!reply) { if (!reply) {
fatalError(3, "[D002, Invalid RPC reply]: " + transport.responseText); fatalError(3, "Sanity check: invalid RPC reply", transport.responseText);
return; return;
} }
@ -170,7 +170,7 @@ function backend_sanity_check_callback(transport) {
init_second_stage(); init_second_stage();
} catch (e) { } catch (e) {
exception_error("backend_sanity_check_callback", e); exception_error("backend_sanity_check_callback", e, transport);
} }
} }

View File

@ -51,14 +51,6 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<div id="extendedErrorBox" style="display : none">
<div id="xebTitle">Fatal Exception</div>
<div id="xebContent">&nbsp;</div>
<div align='center'>
<input type="submit" onclick="closeErrorBox()" value="Close this window"/>
</div>
</div>
<script type="text/javascript"> <script type="text/javascript">
//<![CDATA[ //<![CDATA[
if (navigator.userAgent.match("Opera")) { if (navigator.userAgent.match("Opera")) {
@ -96,11 +88,6 @@
<div id="notify" class="notify"><span id="notify_body">&nbsp;</span></div> <div id="notify" class="notify"><span id="notify_body">&nbsp;</span></div>
<div id="fatal_error"><div id="fatal_error_inner">
<h1>Fatal Error</h1>
<div id="fatal_error_msg">Unknown Error</div>
</div></div>
<div id="dialog_overlay" style="display : none"> </div> <div id="dialog_overlay" style="display : none"> </div>
<script type="text/javascript"> <script type="text/javascript">
@ -112,7 +99,15 @@ window.onload = init;
<ul id="debug_output" style='display : none'><li>&nbsp;</li></ul> <ul id="debug_output" style='display : none'><li>&nbsp;</li></ul>
<div id="infoBoxShadow"><div id="infoBox">&nbsp;</div></div> <div id="infoBoxShadow" style="display : none"><div id="infoBox">&nbsp;</div></div>
<div id="errorBoxShadow" style="display : none">
<div id="errorBox">
<div id="xebTitle">Fatal Exception</div><div id="xebContent">&nbsp;</div>
<div id="xebBtn" align='center'><input type="submit"
onclick="closeErrorBox()" value="Close this window"/></div>
</div>
</div>
<div id="header"> <div id="header">
<div class="topLinks"> <div class="topLinks">

View File

@ -39,7 +39,7 @@ function catchup_callback2(transport, callback) {
setTimeout(callback, 10); setTimeout(callback, 10);
} }
} catch (e) { } catch (e) {
exception_error("catchup_callback2", e); exception_error("catchup_callback2", e, transport);
} }
} }
@ -234,7 +234,7 @@ function headlines_callback2(transport, feed_cur_page) {
remove_splash(); remove_splash();
} catch (e) { } catch (e) {
exception_error_ext("headlines_callback2", e, transport); exception_error("headlines_callback2", e, transport);
} }
} }
@ -290,7 +290,7 @@ function showArticleInHeadlines(id) {
view_mode = document.forms['main_toolbar_form'].view_mode; view_mode = document.forms['main_toolbar_form'].view_mode;
view_mode = view_mode[view_mode.selectedIndex].value; view_mode = view_mode[view_mode.selectedIndex].value;
} catch (e) { } catch (e) {
exception_error("showArticleInHeadlines/viewmode", e, true); //
} }
if (upd_img_pic && upd_img_pic.src.match("updated.png")) { if (upd_img_pic && upd_img_pic.src.match("updated.png")) {
@ -386,7 +386,7 @@ function article_callback2(transport, id, feed_id) {
notify(""); notify("");
} catch (e) { } catch (e) {
exception_error("article_callback2", e); exception_error("article_callback2", e, transport);
} }
} }