summaryrefslogtreecommitdiffstats
path: root/Bugzilla/DB.pm
diff options
context:
space:
mode:
authorJeff Fearn <Jeff.Fearn@gmail.com>2015-06-03 17:01:41 +0200
committerByron Jones <glob@mozilla.com>2015-06-03 17:01:41 +0200
commitdb6b722ddca04ee1d067e010abc3e8e7fd9384c4 (patch)
tree7b7632b96f370a43d79edc645c0339b1d7fd93f4 /Bugzilla/DB.pm
parent4ee100d6667d1a86905d4b37fca9b9b8e75bde1f (diff)
downloadbugzilla-db6b722ddca04ee1d067e010abc3e8e7fd9384c4.tar.gz
bugzilla-db6b722ddca04ee1d067e010abc3e8e7fd9384c4.tar.xz
Bug 1089475: Use "ThrowCodeError" when a database error occurs instead of dumping a stack trace
r=glob,a=glob
Diffstat (limited to 'Bugzilla/DB.pm')
-rw-r--r--Bugzilla/DB.pm8
1 files changed, 8 insertions, 0 deletions
diff --git a/Bugzilla/DB.pm b/Bugzilla/DB.pm
index 9f3ed0f49..adf55f351 100644
--- a/Bugzilla/DB.pm
+++ b/Bugzilla/DB.pm
@@ -142,6 +142,14 @@ sub _handle_error {
$_[0] = substr($_[0], 0, 2000) . ' ... ' . substr($_[0], -2000)
if length($_[0]) > 4000;
$_[0] = Carp::longmess($_[0]);
+
+ if (!Bugzilla->request_cache->{in_error} && Bugzilla->usage_mode == USAGE_MODE_BROWSER) {
+ Bugzilla->request_cache->{in_error} = 1;
+ ThrowCodeError("db_error", {err_message => $_[0]});
+ }
+
+ Bugzilla->request_cache->{in_error} = undef;
+
return 0; # Now let DBI handle raising the error
}