mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-27 02:43:07 +00:00
Bug 140006 - ThrowTemplateError should try a template before using print statements. Patch by gerv, r=bbaetz, justdave.
This commit is contained in:
parent
0aabe0f310
commit
e56fdc0093
@ -916,24 +916,33 @@ sub ThrowUserError {
|
|||||||
# This should only be called if a template->process() fails.
|
# This should only be called if a template->process() fails.
|
||||||
# The Content-Type will already have been printed.
|
# The Content-Type will already have been printed.
|
||||||
sub ThrowTemplateError {
|
sub ThrowTemplateError {
|
||||||
my ($error) = html_quote((@_));
|
($vars->{'error'}) = (@_);
|
||||||
my $maintainer = Param('maintainer');
|
$vars->{'title'} = "Template Error";
|
||||||
|
|
||||||
print <<END;
|
# Try a template first; but if this one fails too, fall back
|
||||||
<tt>
|
# on plain old print statements.
|
||||||
<p>
|
if (!$template->process("global/code-error.html.tmpl", $vars)) {
|
||||||
Bugzilla has suffered an internal error. Please save this page and send
|
my $maintainer = Param('maintainer');
|
||||||
it to $maintainer with details of what you were doing at the time this
|
my $error = html_quote($vars->{'error'});
|
||||||
message appeared.
|
my $error2 = html_quote($template->error());
|
||||||
</p>
|
print <<END;
|
||||||
<script> <!--
|
<tt>
|
||||||
document.write("<p>URL: " + document.location + "</p>");
|
<p>
|
||||||
// -->
|
Bugzilla has suffered an internal error. Please save this page and
|
||||||
</script>
|
send it to $maintainer with details of what you were doing at the
|
||||||
<p>Template->process() failed: $error</p>
|
time this message appeared.
|
||||||
</tt>
|
</p>
|
||||||
|
<script> <!--
|
||||||
|
document.write("<p>URL: " + document.location + "</p>");
|
||||||
|
// -->
|
||||||
|
</script>
|
||||||
|
<p>Template->process() failed twice.<br>
|
||||||
|
First error: $error<br>
|
||||||
|
Second error: $error2</p>
|
||||||
|
</tt>
|
||||||
END
|
END
|
||||||
|
}
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user