]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1089475: Use "ThrowCodeError" when a database error occurs instead of dumping...
authorJeff Fearn <Jeff.Fearn@gmail.com>
Wed, 3 Jun 2015 15:01:41 +0000 (23:01 +0800)
committerByron Jones <glob@mozilla.com>
Wed, 3 Jun 2015 15:01:41 +0000 (23:01 +0800)
r=glob,a=glob

Bugzilla/DB.pm
template/en/default/global/code-error.html.tmpl

index 9f3ed0f494dca73c61321c5ef40db4c7f3a3ffc7..adf55f351961b230fbbf6178eee497a1778ec83f 100644 (file)
@@ -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
 }
 
index d73d75e135d6e174449affc1f3164b87626aacb5..a242c74712ce472dac507f917aec74c473481f1a 100644 (file)
   [% ELSIF error == "comment_type_invalid" %]
     '[% type FILTER html %]' is not a valid comment type.
 
+  [% ELSIF error == "db_error" %]
+    An error occurred while performing a database operation:
+    <pre>[% err_message FILTER html %]</pre>
+
   [% ELSIF error == "db_rename_conflict" %]
     Name conflict: Cannot rename [% old FILTER html %] to
     [%+ new FILTER html %] because [% new FILTER html %] already exists.