diff --git a/webtools/bugzilla/CGI.pl b/webtools/bugzilla/CGI.pl index 979ffda0d4d7..bcbb08d256b3 100644 --- a/webtools/bugzilla/CGI.pl +++ b/webtools/bugzilla/CGI.pl @@ -916,24 +916,33 @@ sub ThrowUserError { # This should only be called if a template->process() fails. # The Content-Type will already have been printed. sub ThrowTemplateError { - my ($error) = html_quote((@_)); - my $maintainer = Param('maintainer'); + ($vars->{'error'}) = (@_); + $vars->{'title'} = "Template Error"; - print < -

- Bugzilla has suffered an internal error. Please save this page and send - it to $maintainer with details of what you were doing at the time this - message appeared. -

- -

Template->process() failed: $error

- + # Try a template first; but if this one fails too, fall back + # on plain old print statements. + if (!$template->process("global/code-error.html.tmpl", $vars)) { + my $maintainer = Param('maintainer'); + my $error = html_quote($vars->{'error'}); + my $error2 = html_quote($template->error()); + print < +

+ Bugzilla has suffered an internal error. Please save this page and + send it to $maintainer with details of what you were doing at the + time this message appeared. +

+ +

Template->process() failed twice.
+ First error: $error
+ Second error: $error2

+ END - + } + exit; }