oxexception.php

Go to the documentation of this file.
00001 <?php
00002 
00007 class oxException extends Exception
00008 {
00009 
00015     protected $_sFileName = 'EXCEPTION_LOG.txt';
00016 
00023     protected $_blRenderer = false;
00024 
00030     protected $_blNotCaught = false;
00031 
00038     public function __construct($sMessage = "not set", $iCode = 0)
00039     {
00040         parent::__construct($sMessage, $iCode);
00041     }
00042 
00048     public function setLogFileName($sFile)
00049     {
00050         $this->_sFileName = $sFile;
00051     }
00052 
00058     public function getLogFileName()
00059     {
00060         return $this->_sFileName;
00061     }
00062 
00068     public function setMessage($sMessage)
00069     {
00070         $this->message = $sMessage;
00071     }
00072 
00076     public function setRenderer()
00077     {
00078         $this->_blRenderer = true;
00079     }
00080 
00086     public function isRenderer()
00087     {
00088         return $this->_blRenderer;
00089     }
00090 
00094     public function setNotCaught()
00095     {
00096         $this->_blNotCaught = true;
00097     }
00098 
00104     public function isNotCaught()
00105     {
00106         return $this->_blNotCaught;
00107     }
00108 
00112     public function debugOut()
00113     {
00114         //We are most likely are already dealing with an exception so making sure no other exceptions interfere
00115         try {
00116             $sLogMsg = $this->getString() . "\n---------------------------------------------\n";
00117             oxRegistry::getUtils()->writeToLog($sLogMsg, $this->getLogFileName());
00118         } catch (Exception $e) {
00119         }
00120     }
00121 
00128     public function getString()
00129     {
00130         $sWarning = "";
00131         if ($this->_blNotCaught) {
00132             $sWarning .= "--!--NOT CAUGHT--!--";
00133         }
00134 
00135         if ($this->_blRenderer) {
00136             $sWarning .= "--!--RENDERER--!--";
00137         }
00138 
00139         return $sWarning . __CLASS__ . " (time: " . date('Y-m-d H:i:s') . "): [{$this->code}]: {$this->message} \n Stack Trace: {$this->getTraceAsString()}\n\n";
00140     }
00141 
00147     /*
00148     public function __toString()
00149     {
00150         return $this->getString();
00151     }
00152     */
00160     public function getValues()
00161     {
00162         return array();
00163     }
00164 
00170     public function setDestination($sDestination)
00171     {
00172     }
00173 }