Changing $bugsys->permissions[] to bugdar::$permissions[]
[bugdar.git] / includes / class_api_error.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar
5 || # Copyright ©2002-2007 Blue Static
6 || #
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version 2 of the License.
10 || #
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 || # more details.
15 || #
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
21
22 /**
23 * API Error Handler
24 *
25 * This class is used to catch different kinds of API errors and throw the
26 * appropriate front-size error depending on the context. Unlike normal
27 * handlers, this class can be both instantiated and used statically: check
28 * the method documentation for more information.
29 *
30 * @author Blue Static
31 * @copyright Copyright ©2002 - 2007, Blue Static
32 * @version $Revision$
33 * @package Bugdar
34 *
35 */
36 class API_Error_Handler
37 {
38 /**
39 * Instance of an object that can run erros
40 * @var object
41 * @access private
42 */
43 var $object = null;
44
45 // ###################################################################
46 /**
47 * Constructor: set the actionable object
48 *
49 * @access public
50 *
51 * @param object Actionable object
52 */
53 function API_Error_Handler(&$obj)
54 {
55 $this->object =& $obj;
56 }
57
58 // ###################################################################
59 /**
60 * The user-end cumulative reporter requires that the class be
61 * instantiated. This collects messages in the set message reporting
62 * object, but never throws the error. It is the caller's responsibility
63 * to check for the presence of errors and to throw the front-end
64 * warning using the message object.
65 *
66 * @access public
67 *
68 * @param string Error message
69 */
70 function user_cumulative($error)
71 {
72 $this->object->addError($error);
73 }
74
75 // ###################################################################
76 /**
77 * This calls the simple ISSO.Printer error message for the
78 * administrative-side errors.
79 *
80 * @access public
81 *
82 * @param string Error message
83 */
84 function admin_error($error)
85 {
86 $this->object->error($error);
87 }
88 }
89
90 /*=====================================================================*\
91 || ###################################################################
92 || # $HeadURL$
93 || # $Id$
94 || ###################################################################
95 \*=====================================================================*/
96 ?>