ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilErrorHandling Class Reference

Error Handling & global info handling uses PEAR error class. More...

+ Inheritance diagram for ilErrorHandling:
+ Collaboration diagram for ilErrorHandling:

Public Member Functions

 ilErrorHandling ()
 Constructor public.
 getLastError ()
 errorHandler ($a_error_obj)
 defines what has to happen in case of error private
 getMessage ()
 setMessage ($a_message)
 appendMessage ($a_message)

Static Public Member Functions

static _ilErrorWriter ($errno, $errstr, $errfile, $errline)
 This is used in Soap calls to write PHP error in ILIAS Logfile Not used yet!!!

Data Fields

 $DEBUG_ENV
 $FATAL
 $WARNING
 $MESSAGE

Detailed Description

Error Handling & global info handling uses PEAR error class.

Author
Stefan Meyer smeye.nosp@m.r@da.nosp@m.tabay.nosp@m..de
Sascha Hofmann shofm.nosp@m.ann@.nosp@m.datab.nosp@m.ay.d.nosp@m.e
Version
Id:
class.ilErrorHandling.php 13439 2007-03-13 14:33:45Z smeyer
Todo:
when an error occured and clicking the back button to return to previous page the referer-var in session is deleted -> server error

Definition at line 37 of file class.ilErrorHandling.php.

Member Function Documentation

static ilErrorHandling::_ilErrorWriter (   $errno,
  $errstr,
  $errfile,
  $errline 
)
static

This is used in Soap calls to write PHP error in ILIAS Logfile Not used yet!!!

public

Parameters

Definition at line 210 of file class.ilErrorHandling.php.

References $ilLog, and exit.

{
global $ilLog;
switch($errno)
{
case E_USER_ERROR:
$ilLog->write('PHP errror: '.$errstr.'. FATAL error on line '.$errline.' in file '.$errfile);
unset($ilLog);
exit(1);
case E_USER_WARNING:
$ilLog->write('PHP warning: ['.$errno.'] '.$errstr.' on line '.$errline.' in file '.$errfile);
break;
}
return true;
}
ilErrorHandling::appendMessage (   $a_message)

Definition at line 192 of file class.ilErrorHandling.php.

References getMessage().

{
if($this->getMessage())
{
$this->message .= "<br /> ";
}
$this->message .= $a_message;
}

+ Here is the call graph for this function:

ilErrorHandling::errorHandler (   $a_error_obj)

defines what has to happen in case of error private

Parameters
objectError

Definition at line 94 of file class.ilErrorHandling.php.

References $_SESSION, $FATAL, $log, $MESSAGE, $WARNING, and ilUtil\redirect().

{
global $log;
$this->error_obj =& $a_error_obj;
//echo "-".$_SESSION["referer"]."-";
if ($_SESSION["message"])
{
$m = "Fatal Error: Called raise error two times.<br>".
"First error: ".$_SESSION["message"].'<br>'.
"Last Error:". $a_error_obj->getMessage();
//return;
$log->logError($a_error_obj->getCode(), $m);
unset($_SESSION["message"]);
die ($m);
}
if (is_object($log) and $log->enabled == true)
{
$log->logError($a_error_obj->getCode(),$a_error_obj->getMessage());
}
//echo $a_error_obj->getCode().":"; exit;
if ($a_error_obj->getCode() == $this->FATAL)
{
die (stripslashes($a_error_obj->getMessage()));
}
if ($a_error_obj->getCode() == $this->WARNING)
{
if ($this->DEBUG_ENV)
{
$message = $a_error_obj->getMessage();
}
else
{
$message = "Under Construction";
}
$_SESSION["message"] = $message;
if (!defined("ILIAS_MODULE"))
{
ilUtil::redirect("error.php");
}
else
{
ilUtil::redirect("../error.php");
}
}
if ($a_error_obj->getCode() == $this->MESSAGE)
{
$_SESSION["message"] = $a_error_obj->getMessage();
// save post vars to session in case of error
$_SESSION["error_post_vars"] = $_POST;
if (empty($_SESSION["referer"]))
{
$dirname = dirname($_SERVER["PHP_SELF"]);
$ilurl = parse_url(ILIAS_HTTP_PATH);
$subdir = substr(strstr($dirname,$ilurl["path"]),strlen($ilurl["path"]));
$updir = "";
if ($subdir)
{
$num_subdirs = substr_count($subdir,"/");
for ($i=1;$i<=$num_subdirs;$i++)
{
$updir .= "../";
}
}
ilUtil::redirect($updir."index.php");
}
// check if already GET-Parameters exists in Referer-URI
if (substr($_SESSION["referer"],-4) == ".php")
{
$glue = "?";
}
else
{
$glue = "&";
}
#echo "-".$_SESSION["referer"]."-";
ilUtil::redirect($_SESSION["referer"].$glue);
}
}

+ Here is the call graph for this function:

ilErrorHandling::getLastError ( )

Definition at line 84 of file class.ilErrorHandling.php.

{
return $this->error_obj;
}
ilErrorHandling::getMessage ( )

Definition at line 184 of file class.ilErrorHandling.php.

Referenced by appendMessage().

{
return $this->message;
}

+ Here is the caller graph for this function:

ilErrorHandling::ilErrorHandling ( )

Constructor public.

Definition at line 71 of file class.ilErrorHandling.php.

{
$this->PEAR();
// init vars
$this->DEBUG_ENV = true;
$this->FATAL = 1;
$this->WARNING = 2;
$this->MESSAGE = 3;
$this->error_obj = false;
}
ilErrorHandling::setMessage (   $a_message)

Definition at line 188 of file class.ilErrorHandling.php.

{
$this->message = $a_message;
}

Field Documentation

ilErrorHandling::$DEBUG_ENV

Definition at line 44 of file class.ilErrorHandling.php.

ilErrorHandling::$FATAL

Definition at line 51 of file class.ilErrorHandling.php.

Referenced by errorHandler().

ilErrorHandling::$MESSAGE

Definition at line 65 of file class.ilErrorHandling.php.

Referenced by errorHandler().

ilErrorHandling::$WARNING

Definition at line 58 of file class.ilErrorHandling.php.

Referenced by errorHandler().


The documentation for this class was generated from the following file: