5.7.30. Bugzilla::Error

5.7.30.1. NAME

Bugzilla::Error - Error handling utilities for Bugzilla

5.7.30.2. SYNOPSIS

use Bugzilla::Error;

ThrowUserError("error_tag",
               { foo => 'bar' });

5.7.30.3. DESCRIPTION

Various places throughout the Bugzilla codebase need to report errors to the user. The Throw\*Error family of functions allow this to be done in a generic and localizable manner.

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.

5.7.30.4. FUNCTIONS

ThrowUserError

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 global/user-error.html.tmpl template to format the error, using the passed in variables as required.

ThrowCodeError

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.

This function's behaviour is similar to ThrowUserError, except that the template used to display errors is global/code-error.html.tmpl. In addition if the hashref used as the optional second argument contains a key variablesthen the contents of the hashref (which is expected to be another hashref) will be displayed after the error message, as a debugging aid.

ThrowTemplateError

This function should only be called if a template-<gtprocess()> 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.

5.7.30.5. SEE ALSO

Bugzilla|Bugzilla


This documentation undoubtedly has bugs; if you find some, please file them here.