Location: PHPKode > projects > Docyrus > docyrus/sweetException.php
<?php
/**
 * Docyrus
 *
 * @version Pre-Alpha
 * @copyright 2005-2006 CERDECAM
 * Last update : 12th of July in 2006
 * 
 * @license This program is under the terms of the GENERAL PUBLIC LICENSE
 * 		(GPL) as published by the FREE SOFTWARE FOUNDATION. The GPL
 * 		is available through the world-wide-web at http://www.gnu.org/copyleft/gpl.html
 * 
 * @author Leblanc Nicolas <hide@address.com>
 * @package /
 * @filesource sweetException.php
 * 
 * @description Definition of an exception how store a result to be return if
 * 		the user allow non critical errors.
 */
/**
 * This class define an Exception to send if there is an error but the execution give a result (to keep or not). To assure to have a result:
 * 	<pre>
 * 	try {
 * 		$newDoc = $docyrusPlateform->createMyDocumentFromIdsAndDoms($listOfDoms, $listOfIds, 'Title');
 * 	}
 * 	catch(SweetException $e) {
 * 		$newDoc = $e->getResult();
 * 	}
 * 	</pre>
 * @package Exception
 */
class SweetException extends Exception 
{
	/**
	 * @var Mixed $result is the container for the varibale to get back.
	 * @access private
	 */
	private $result;
	
	/**
	 * Constructor for SweetException. It initialize an Exception and the result for the user.
	 */
	function __construct($message, $result, $code = 0)
	{
		$this->result = $result;
		parent::__construct($message, $code);
	}
	
	/**
	 * Function to get the result obtained before execution failed.
	 */
	function getResult()
	{
		return $this->result;	
	}
}
?>
Return current item: Docyrus