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 
00123     public function debugOut($iDebug = -1)
00124     {
00125         //We are most likely are already dealing with an exception so making sure no other exceptions interfere
00126         try {
00127             $sLogMsg = $this->getString() . "\n---------------------------------------------\n";
00128             oxUtils::getInstance()->writeToLog( $sLogMsg, $this->getLogFileName() );
00129         } catch (Exception $e) {
00130         }
00131     }
00132 
00139     public function getString()
00140     {
00141         $sWarning = "";
00142         if ( $this->_blNotCaught ) {
00143             $sWarning .= "--!--NOT CAUGHT--!--";
00144         }
00145 
00146         if ( $this->_blRenderer ) {
00147             $sWarning .= "--!--RENDERER--!--";
00148         }
00149 
00150         return $sWarning . __CLASS__ . " (time: ". date('Y-m-d H:i:s') ."): [{$this->code}]: {$this->message} \n Stack Trace: {$this->getTraceAsString()}\n\n";
00151     }
00152 
00158     /*
00159     public function __toString()
00160     {
00161         return $this->getString();
00162     }
00163     */
00171     public function getValues()
00172     {
00173         return array();
00174     }
00175 
00183     public function setDestination( $sDestination )
00184     {
00185     }
00186 }