summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-05-14 16:11:38 +0200
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-05-14 16:11:38 +0200
commit8bc37c2d851e06b036c8f895582fedd7051b3592 (patch)
tree65aacd22bb02b4b25fb04f16b8720965900574e8
parent0d8aa2755abd5b62cbf0d8368b2e97a73bfcdd0d (diff)
downloadbugzilla-8bc37c2d851e06b036c8f895582fedd7051b3592.tar.gz
bugzilla-8bc37c2d851e06b036c8f895582fedd7051b3592.tar.xz
Bug 372537: Improve CodeErrors: show the traceback (without function
arguments) r=LpSolit, a=LpSolit
-rw-r--r--Bugzilla/Error.pm8
-rw-r--r--template/en/default/global/code-error.html.tmpl3
2 files changed, 11 insertions, 0 deletions
diff --git a/Bugzilla/Error.pm b/Bugzilla/Error.pm
index 0c471125d..60e7837de 100644
--- a/Bugzilla/Error.pm
+++ b/Bugzilla/Error.pm
@@ -31,6 +31,8 @@ use base qw(Exporter);
use Bugzilla::Constants;
use Bugzilla::WebService::Constants;
use Bugzilla::Util;
+
+use Carp;
use Date::Format;
# We cannot use $^S to detect if we are in an eval(), because mod_perl
@@ -50,6 +52,12 @@ sub _throw_error {
$vars ||= {};
$vars->{error} = $error;
+ # Don't show function arguments, in case they contain confidential data.
+ local $Carp::MaxArgNums = -1;
+ # Don't show the error as coming from Bugzilla::Error, show it as coming
+ # from the caller.
+ local $Carp::CarpInternal{'Bugzilla::Error'} = 1;
+ $vars->{traceback} = Carp::longmess();
# Make sure any transaction is rolled back (if supported).
# If we are within an eval(), do not roll back transactions as we are
diff --git a/template/en/default/global/code-error.html.tmpl b/template/en/default/global/code-error.html.tmpl
index c91bc66ee..e3bd3ba8b 100644
--- a/template/en/default/global/code-error.html.tmpl
+++ b/template/en/default/global/code-error.html.tmpl
@@ -539,6 +539,9 @@
</tr>
</table>
+<p>Traceback:</p>
+<pre>[% traceback FILTER html_linebreak %]</pre>
+
[% IF variables %]
<pre>
Variables: