15 include_once
'PEAR.php';
56 $this->DEBUG_ENV =
true;
61 $this->error_obj =
false;
63 set_exception_handler(array($this,
'handleUncaughtException'));
68 return $this->error_obj;
82 if ($a_error_obj->getCode() == null)
87 $this->error_obj =& $a_error_obj;
89 if (
$_SESSION[
"failure"] && substr($a_error_obj->getMessage(), 0, 22) !=
"Cannot find this block")
91 $m =
"Fatal Error: Called raise error two times.<br>".
92 "First error: ".$_SESSION[
"failure"].
'<br>'.
93 "Last Error:". $a_error_obj->getMessage();
95 $log->logError($a_error_obj->getCode(), $m);
100 if (substr($a_error_obj->getMessage(), 0, 22) ==
"Cannot find this block")
104 echo
"<b>DEVMODE</b><br><br>";
105 echo
"<b>Template Block not found.</b><br>";
106 echo
"You used a template block in your code that is not available.<br>";
107 echo
"Native Messge: <b>".$a_error_obj->getMessage().
"</b><br>";
108 if (is_array($a_error_obj->backtrace))
110 echo
"Backtrace:<br>";
111 foreach ($a_error_obj->backtrace as $b)
113 if ($b[
"function"] ==
"setCurrentBlock" &&
114 basename($b[
"file"]) !=
"class.ilTemplate.php")
118 echo
"File: ".$b[
"file"].
", ";
119 echo
"Line: ".$b[
"line"].
", ";
120 echo $b[
"function"].
"()<br>";
121 if ($b[
"function"] ==
"setCurrentBlock" &&
122 basename($b[
"file"]) !=
"class.ilTemplate.php")
133 if (is_object($log) and $log->enabled ==
true)
135 $log->logError($a_error_obj->getCode(),$a_error_obj->getMessage());
141 trigger_error(stripslashes($a_error_obj->getMessage()), E_USER_ERROR);
147 if ($this->DEBUG_ENV)
149 $message = $a_error_obj->getMessage();
153 $message =
"Under Construction";
158 if (!defined(
"ILIAS_MODULE"))
170 $_SESSION[
"failure"] = $a_error_obj->getMessage();
176 $dirname = dirname($_SERVER[
"PHP_SELF"]);
177 $ilurl = parse_url(ILIAS_HTTP_PATH);
178 $subdir = substr(strstr($dirname,$ilurl[
"path"]),strlen($ilurl[
"path"]));
183 $num_subdirs = substr_count($subdir,
"/");
185 for ($i=1;$i<=$num_subdirs;$i++)
211 return $this->message;
215 $this->message = $a_message;
221 $this->message .=
"<br /> ";
223 $this->message .= $a_message;
242 $ilLog->write(
'PHP errror: '.$errstr.
'. FATAL error on line '.$errline.
' in file '.$errfile);
247 $ilLog->write(
'PHP warning: ['.$errno.
'] '.$errstr.
' on line '.$errline.
' in file '.$errfile);
260 $error = $e->getMessage();
263 $error.=
'<br /><br />';
264 $error.= nl2br($e->getTraceAsString());
ilErrorHandling()
Constructor public.
appendMessage($a_message)
PEAR($error_class=null)
Constructor.
errorHandler($a_error_obj)
defines what has to happen in case of error private
handleUncaughtException(Exception $e)
Called for each uncaught exception.
static _ilErrorWriter($errno, $errstr, $errfile, $errline)
This is used in Soap calls to write PHP error in ILIAS Logfile Not used yet!!!
Error Handling & global info handling uses PEAR error class.
& raiseError($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
This method is a wrapper that returns an instance of the configured error class with this object's de...
static redirect($a_script)
http redirect to other script