oxexception.php

Go to the documentation of this file.
00001 <?php
00002 
00007 class oxException extends Exception
00008 {
00014     protected $_sFileName = 'EXCEPTION_LOG.txt';
00015 
00022     protected $_blRenderer = false;
00023 
00029     protected $_blNotCaught = false;
00030 
00037     public function __construct($sMessage = "not set", $iCode = 0)
00038     {
00039         parent::__construct($sMessage, $iCode);
00040     }
00041 
00049     public function setLogFileName($sFile)
00050     {
00051         $this->_sFileName = $sFile;
00052     }
00053 
00059     public function getLogFileName()
00060     {
00061         return $this->_sFileName;
00062     }
00063 
00071     public function setMessage($sMessage)
00072     {
00073         $this->message = $sMessage;
00074     }
00075 
00081     public function setRenderer()
00082     {
00083         $this->_blRenderer = true;
00084     }
00085 
00091     public function isRenderer()
00092     {
00093         return $this->_blRenderer;
00094     }
00095 
00101     public function setNotCaught()
00102     {
00103         $this->_blNotCaught = true;
00104     }
00105 
00111     public function isNotCaught()
00112     {
00113         return $this->_blNotCaught;
00114     }
00115 
00121     public function debugOut()
00122     {
00123         //We are most likely are already dealing with an exception so making sure no other exceptions interfere
00124         try {
00125             $sLogMsg = $this->getString() . "\n---------------------------------------------\n";
00126             oxRegistry::getUtils()->writeToLog( $sLogMsg, $this->getLogFileName() );
00127         } catch (Exception $e) {
00128         }
00129     }
00130 
00137     public function getString()
00138     {
00139         $sWarning = "";
00140         if ( $this->_blNotCaught ) {
00141             $sWarning .= "--!--NOT CAUGHT--!--";
00142         }
00143 
00144         if ( $this->_blRenderer ) {
00145             $sWarning .= "--!--RENDERER--!--";
00146         }
00147 
00148         return $sWarning . __CLASS__ . " (time: ". date('Y-m-d H:i:s') ."): [{$this->code}]: {$this->message} \n Stack Trace: {$this->getTraceAsString()}\n\n";
00149     }
00150 
00156     /*
00157     public function __toString()
00158     {
00159         return $this->getString();
00160     }
00161     */
00169     public function getValues()
00170     {
00171         return array();
00172     }
00173 
00181     public function setDestination( $sDestination )
00182     {
00183     }
00184 }