<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title> Bugzilla::Error</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" title="style" type="text/css" href=".././../../../../style.css" media="all" > </head> <body id="pod"> <p class="backlinktop"><b><a name="___top" href="../index.html" accesskey="1" title="All Documents"><<</a></b></p> <h1>Bugzilla::Error</h1> <div class='indexgroup'> <ul class='indexList indexList1'> <li class='indexItem indexItem1'><a href='#NAME'>NAME</a> <li class='indexItem indexItem1'><a href='#SYNOPSIS'>SYNOPSIS</a> <li class='indexItem indexItem1'><a href='#DESCRIPTION'>DESCRIPTION</a> <li class='indexItem indexItem1'><a href='#FUNCTIONS'>FUNCTIONS</a> <li class='indexItem indexItem1'><a href='#SEE_ALSO'>SEE ALSO</a> </ul> </div> <h1><a class='u' href='#___top' title='click to go to top of document' name="NAME" >NAME</a></h1> <p>Bugzilla::Error - Error handling utilities for Bugzilla</p> <h1><a class='u' href='#___top' title='click to go to top of document' name="SYNOPSIS" >SYNOPSIS</a></h1> <pre class="code"> use Bugzilla::Error; ThrowUserError("error_tag", { foo => 'bar' });</pre> <h1><a class='u' href='#___top' title='click to go to top of document' name="DESCRIPTION" >DESCRIPTION</a></h1> <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> <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> <h1><a class='u' href='#___top' title='click to go to top of document' name="FUNCTIONS" >FUNCTIONS</a></h1> <dl> <dt><a name="ThrowUserError" ><code class="code">ThrowUserError</code></a></dt> <dd> <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> <dt><a name="ThrowCodeError" ><code class="code">ThrowCodeError</code></a></dt> <dd> <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> <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> <dt><a name="ThrowTemplateError" ><code class="code">ThrowTemplateError</code></a></dt> <dd> <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> </dd> </dl> <h1><a class='u' href='#___top' title='click to go to top of document' name="SEE_ALSO" >SEE ALSO</a></h1> <p><a href="../Bugzilla.html" class="podlinkpod" >Bugzilla</a></p> <p class="backlinkbottom"><b><a name="___bottom" href="../index.html" title="All Documents"><<</a></b></p> <!-- end doc --> </body></html>