Odyssey
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CatchErrorHandler Class Reference
Inheritance diagram for CatchErrorHandler:
CatchHandler

Public Member Functions

 __construct ($pSetProduct, $pSetLogger=null, $pDevMode=false)
 
 catchError ($pErrNo, $pErrStr, $pErrFile, $pErrLine)
 
 getErrMsg ()
 
 addFileIgnore ($pFileName)
 
 addErrStrIgnore ($pFileName)
 
- Public Member Functions inherited from CatchHandler
 __construct ($pSetProduct, $pSetLogger=null)
 
 setLogger ($pLogger)
 
 setDevMode ($pDevMode)
 
 getDevMode ()
 
 setErrorReporting ($pNewReportLvl)
 
 getErrorReporting ()
 

Private Member Functions

 getSaveLog ()
 

Private Attributes

 $errNo
 
 $errStr
 
 $errFile
 
 $errLine
 
 $errType
 
 $errConstants
 
 $ignoreFileErrors
 
 $ignoreErrorString
 

Additional Inherited Members

- Protected Member Functions inherited from CatchHandler
 handleError ()
 
 setSaveLog ($pSaveLog)
 
 getErrMsg ()
 
 setNotice ($pNoticeOnly)
 
- Protected Attributes inherited from CatchHandler
 $errLogger = null
 
 $errReportLvl = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
 
 $errRemoteAddr
 
 $errRequestUri
 
 $errServerName
 
 $errPhpSelf
 
 $errScriptName
 
 $errQueryString
 

Detailed Description

Definition at line 293 of file hcuLogError.i.

Member Function Documentation

◆ addErrStrIgnore()

CatchErrorHandler::addErrStrIgnore (   $pFileName)

Add a file to the ignore list. This may be added to ignore a particular script on the fly

Parameters
string$pFileName- The name of the file to be added to the array

Definition at line 459 of file hcuLogError.i.

461  {

◆ addFileIgnore()

CatchErrorHandler::addFileIgnore (   $pFileName)

Add a file to the ignore list. This may be added to ignore a particular script on the fly

Parameters
string$pFileName- The name of the file to be added to the array

Definition at line 450 of file hcuLogError.i.

452  {

◆ getErrMsg()

CatchErrorHandler::getErrMsg ( )

Build the error message from the exception information Specific to the fields that were passed into the Error Handler

Returns
string Returns formatted error string

Definition at line 430 of file hcuLogError.i.

432  {
433  $lRetStr = "";
434  $lCurDate = date("Ymd:His");
435  $lCurDate = date("d/M/Y:H:i:s");
436 
437  // ** Format for Log File
438  $lRetStr = <<< LOGMSG
439 [{$lCurDate}] $this->errType [{$this->errRemoteAddr}] [{$this->errServerName}{$this->errPhpSelf}?{$this->errQueryString}] [$this->errFile] [Line $this->errLine] [$this->errNo] $this->errStr
440 LOGMSG;
441 
442  // ** At this time I don't see a need to add trace to an error log
443 

◆ getSaveLog()

CatchErrorHandler::getSaveLog ( )
private

determine if we will save the log file This will examine the {ignored files/error string} arrays and determine if the log should be saved

Returns
boolean - {true/false} true if the log should be saved

Definition at line 362 of file hcuLogError.i.

364  {
365  $retVal = false;
366  parent::setNotice(false);
367 
368  // * Verify we want to report the error based on the Error
369  if (($this->getErrorReporting() & $this->errNo) > 0) {
370  switch ($this->errNo) {
371  case E_NOTICE:
372  // ** for E_NOTICE -- set the flag to show the errors as a notice
373  parent::setNotice(true);
374 
375  case E_USER_ERROR:
376  case E_USER_WARNING:
377  case E_USER_NOTICE:
378 
379  case E_ERROR:
380 
381  case E_PARSE:
382 
383  case E_DEPRECATED:
384  case E_USER_DEPRECATED:
385  $retVal = true;
386  break;
387  case E_WARNING:
388 
389  // ** check to see if the file raising the error is in the exception list
390  // Determine if it the file exists in the ignoreFileList array
391 
392  $retVal = (in_array(basename($this->errFile), $this->ignoreFileErrors) === false);
393 
394  // * ONLY consider the next check if retVal is true, if false, then skip
395  if ($retVal) {
396  $retVal = (in_array($this->errStr, $this->ignoreErrorString) === false);
397  }
398  }
399  }

Member Data Documentation

◆ $errConstants

CatchErrorHandler::$errConstants
private
Initial value:
= Array (
"1" => "[E_ERROR]",
"2" => "[E_WARNING]",
"4" => "[E_PARSE]",
"8" => "[E_NOTICE]",
"16" => "[E_CORE_ERROR]",
"32" => "[E_CORE_WARNING]",
"64" => "[E_COMPILE_ERROR]",
"128" => "[E_COMPILE_WARNING]",
"256" => "[E_USER_ERROR]",
"512" => "[E_USER_WARNING]",
"1024" => "[E_USER_NOTICE]",
"2048" => "[E_STRICT]",
"4096" => "[E_RECOVERABLE_ERROR]",
"8192" => "[E_DEPRECATED]",
"16384" => "[E_USER_DEPRECATED]",
"32767" => "[E_ALL]"
)

Definition at line 319 of file hcuLogError.i.

◆ $ignoreErrorString

CatchErrorHandler::$ignoreErrorString
private
Initial value:
= Array(
"file-get-contents", "SSL: fatal protocol"
)

Default list of error strings to ignore

Definition at line 349 of file hcuLogError.i.

◆ $ignoreFileErrors

CatchErrorHandler::$ignoreFileErrors
private
Initial value:
= Array(
"db.postgres.i"
)

Default list of files to ignore errors

Definition at line 341 of file hcuLogError.i.


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