<?php
/*=====================================================================*\
|| ###################################################################
|| # Bugdar [#]version[#]
|| # Copyright ©2002-[#]year[#] Blue Static
|| #
|| # This program is free software; you can redistribute it and/or modify
|| # it under the terms of the GNU General Public License as published by
|| # the Free Software Foundation; version [#]gpl[#] of the License.
|| #
|| # This program is distributed in the hope that it will be useful, but
|| # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|| # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|| # more details.
|| #
|| # You should have received a copy of the GNU General Public License along
|| # with this program; if not, write to the Free Software Foundation, Inc.,
|| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|| ###################################################################
\*=====================================================================*/

/**
* API Error Handler
*
* This class is used to catch different kinds of API errors and throw the
* appropriate front-size error depending on the context. Unlike normal
* handlers, this class can be both instantiated and used statically: check
* the method documentation for more information.
*
* @author		Blue Static
* @copyright	Copyright ©2002 - [#]year[#], Blue Static
* @version		$Revision$
* @package		Bugdar
*
*/
class API_Error_Handler
{
	/**
	* Instance of an object that can run erros
	* @var	object
	* @access	private
	*/
	var $object = null;

	// ###################################################################
	/**
	* Constructor: set the actionable object
	*
	* @access	public
	*
	* @param	object	Actionable object
	*/
	function API_Error_Handler(&$obj)
	{
		$this->object =& $obj;
	}

	// ###################################################################
	/**
	* The user-end cumulative reporter requires that the class be
	* instantiated. This collects messages in the set message reporting
	* object, but never throws the error. It is the caller's responsibility
	* to check for the presence of errors and to throw the front-end
	* warning using the message object.
	*
	* @access	public
	*
	* @param	string	Error message
	*/
	function user_cumulative($error)
	{
		$this->object->addError($error);
	}

	// ###################################################################
	/**
	* This calls the simple ISSO.Printer error message for the
	* administrative-side errors.
	*
	* @access	public
	*
	* @param	string	Error message
	*/
	function admin_error($error)
	{
		$this->object->error($error);
	}
}

/*=====================================================================*\
|| ###################################################################
|| # $HeadURL$
|| # $Id$
|| ###################################################################
\*=====================================================================*/
?>