1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
5
Bugzilla::Error</title>
6
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
7
<link rel="stylesheet" title="style" type="text/css" href="../style.css" media="all" >
11
<p class="backlinktop"><b><a name="___top" href="../index.html" accesskey="1" title="All Documents"><<</a></b></p>
12
<h1>Bugzilla::Error</h1>
13
<div class='indexgroup'>
14
<ul class='indexList indexList1'>
15
<li class='indexItem indexItem1'><a href='#NAME'>NAME</a>
16
<li class='indexItem indexItem1'><a href='#SYNOPSIS'>SYNOPSIS</a>
17
<li class='indexItem indexItem1'><a href='#DESCRIPTION'>DESCRIPTION</a>
18
<li class='indexItem indexItem1'><a href='#FUNCTIONS'>FUNCTIONS</a>
19
<li class='indexItem indexItem1'><a href='#SEE_ALSO'>SEE ALSO</a>
23
<h1><a class='u' href='#___top' title='click to go to top of document'
27
<p>Bugzilla::Error - Error handling utilities for Bugzilla</p>
29
<h1><a class='u' href='#___top' title='click to go to top of document'
33
<pre class="code"> use Bugzilla::Error;
35
ThrowUserError("error_tag",
36
{ foo => 'bar' });</pre>
38
<h1><a class='u' href='#___top' title='click to go to top of document'
42
<p>Various places throughout the Bugzilla codebase need to report errors to the user. The <code class="code">Throw*Error</code> family of functions allow this to be done in a generic and localizable manner.</p>
44
<p>These functions automatically unlock the database tables, if there were any locked. They will also roll back the transaction, if it is supported by the underlying DB.</p>
46
<h1><a class='u' href='#___top' title='click to go to top of document'
51
<dt><a name="ThrowUserError"
52
><code class="code">ThrowUserError</code></a></dt>
55
<p>This function takes an error tag as the first argument, and an optional hashref of variables as a second argument. These are used by the <i>global/user-error.html.tmpl</i> template to format the error, using the passed in variables as required.</p>
57
<dt><a name="ThrowCodeError"
58
><code class="code">ThrowCodeError</code></a></dt>
61
<p>This function is used when an internal check detects an error of some sort. This usually indicates a bug in Bugzilla, although it can occur if the user manually constructs urls without correct parameters.</p>
63
<p>This function's behaviour is similar to <code class="code">ThrowUserError</code>, except that the template used to display errors is <i>global/code-error.html.tmpl</i>. In addition if the hashref used as the optional second argument contains a key <i>variables</i> then the contents of the hashref (which is expected to be another hashref) will be displayed after the error message, as a debugging aid.</p>
65
<dt><a name="ThrowTemplateError"
66
><code class="code">ThrowTemplateError</code></a></dt>
69
<p>This function should only be called if a <code class="code">template-<gt</code>process()> fails. It tries another template first, because often one template being broken or missing doesn't mean that they all are. But it falls back to a print statement as a last-ditch error.</p>
73
<h1><a class='u' href='#___top' title='click to go to top of document'
77
<p><a href="../Bugzilla.html" class="podlinkpod"
79
<p class="backlinkbottom"><b><a name="___bottom" href="../index.html" title="All Documents"><<</a></b></p>