<<

Bugzilla::Error

NAME

Bugzilla::Error - Error handling utilities for Bugzilla

SYNOPSIS

  use Bugzilla::Error;

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

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.

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 variables then 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.

SEE ALSO

Bugzilla

<<