2 /* vim: set expandtab tabstop=4 shiftwidth=4: */
3 // +----------------------------------------------------------------------+
5 // +----------------------------------------------------------------------+
6 // | Copyright (c) 1997-2002 The PHP Group |
7 // +----------------------------------------------------------------------+
8 // | This source file is subject to version 2.02 of the PHP license, |
9 // | that is bundled with this package in the file LICENSE, and is |
10 // | available at through the world-wide-web at |
11 // | http://www.php.net/license/2_02.txt. |
12 // | If you did not receive a copy of the PHP license and are unable to |
13 // | obtain it through the world-wide-web, please send a note to |
14 // | license@php.net so we can mail you a copy immediately. |
15 // +----------------------------------------------------------------------+
16 // | Authors: Alan Knowles <alan@akbkhome.com> |
17 // +----------------------------------------------------------------------+
19 // $Id: Error.php,v 1.3 2003/02/22 01:52:50 alan Exp $
21 // The simple error handler.
25 require_once 'HTML/FlexyFramework/Page.php';
29 * Simple Error handler
32 * Currenly just displays a page error.html when you redirect to it.
33 * eg. in your start or get methods do
35 * PEAR::RaiseError('some error message');
39 * Needs to log errors really..
44 class HTML_FlexyFramework_Error extends HTML_FlexyFramework_Page {
47 * The error page (this should really be configurable using the config file)
49 * done by overriding the template body..
53 var $template = "error.html";
56 * Override getAuth to let everyone see the error page.
65 * Override start method to set the $this->error_message to the last recorded error
69 function start($request,$isRedirect=false,$args=array())
71 //echo "Running error page";
72 $error = &PEAR::getStaticProperty('pages_error','error');
74 $this->errorMessage = "unknown error";
76 $this->errorMessage = $error->getMessage();
81 * Store the last Recorded Error message in PEAR::getStaticProperty('pages_error','error');
82 * This is the default hanlder for all pear errors (As set up in the framework class)
87 function raiseError($newError) {
89 $error = &PEAR::getStaticProperty('pages_error','error');
93 * Fetch the last error object
94 * @return object PEAR error object
98 return PEAR::getStaticProperty('pages_error','error');