[tahoe-dev] [tahoe-lafs] #971: "Humanized failures" should still have a traceback, hidden by default
tahoe-lafs
trac at allmydata.org
Wed Feb 24 18:47:28 PST 2010
#971: "Humanized failures" should still have a traceback, hidden by default
-------------------------------+--------------------------------------------
Reporter: davidsarah | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: 1.7.0
Component: code-frontend-web | Version: 1.6.0
Keywords: error | Launchpad_bug:
-------------------------------+--------------------------------------------
Currently, failures that occur in a WUI operation (that is, a webapi
operation with HTML output) go through
[source:src/allmydata/test/common.py#L149 humanize_failure] in
{{{test/common.py}}}, in order to produce a more informative error
message. This is better in most cases than dumping an exception traceback,
but sometimes you really do ''also'' want the traceback for debugging.
DHTML could be used to hide the traceback by default, like this:
{{{
<!doctype html>
<html>
<head>
<script type="text/javascript">
function toggleDebug() {
var el = document.getElementById('debug');
show = el.style.display === 'none';
el.style.display = show ? '' : 'none';
document.getElementById('toggle').innerHTML =
show ? 'Hide debugging information' : 'Show debugging
information';
}
window.onload = toggleDebug;
</script>
</head>
<body>
<p>
<a id="toggle" onclick="toggleDebug();"
style="text-decoration: none; border-bottom: 1px dashed #000000"></a>
</p>
<div id="debug"><p>Traceback</p></div>
</body>
</html>
}}}
A traceback can be obtained from a {{{twisted.python.failure.Failure}}}
object using:
{{{
from StringIO import StringIO
sfile = StringIO()
f.printTraceback(sfile) # or printDetailedTraceback
sfile.flush()
... sfile.getvalue() ...
}}}
--
Ticket URL: <http://allmydata.org/trac/tahoe/ticket/971>
tahoe-lafs <http://allmydata.org>
secure decentralized file storage grid
More information about the tahoe-dev
mailing list