OXID eShop CE  4.8.12
 All Classes Files Functions Variables Pages
oxexception.php
Go to the documentation of this file.
1 <?php
2 
7 class oxException extends Exception
8 {
14  protected $_sFileName = 'EXCEPTION_LOG.txt';
15 
22  protected $_blRenderer = false;
23 
29  protected $_blNotCaught = false;
30 
37  public function __construct($sMessage = "not set", $iCode = 0)
38  {
39  parent::__construct($sMessage, $iCode);
40  }
41 
49  public function setLogFileName($sFile)
50  {
51  $this->_sFileName = $sFile;
52  }
53 
59  public function getLogFileName()
60  {
61  return $this->_sFileName;
62  }
63 
71  public function setMessage($sMessage)
72  {
73  $this->message = $sMessage;
74  }
75 
81  public function setRenderer()
82  {
83  $this->_blRenderer = true;
84  }
85 
91  public function isRenderer()
92  {
93  return $this->_blRenderer;
94  }
95 
101  public function setNotCaught()
102  {
103  $this->_blNotCaught = true;
104  }
105 
111  public function isNotCaught()
112  {
113  return $this->_blNotCaught;
114  }
115 
121  public function debugOut()
122  {
123  //We are most likely are already dealing with an exception so making sure no other exceptions interfere
124  try {
125  $sLogMsg = $this->getString() . "\n---------------------------------------------\n";
126  oxRegistry::getUtils()->writeToLog( $sLogMsg, $this->getLogFileName() );
127  } catch (Exception $e) {
128  }
129  }
130 
137  public function getString()
138  {
139  $sWarning = "";
140  if ( $this->_blNotCaught ) {
141  $sWarning .= "--!--NOT CAUGHT--!--";
142  }
143 
144  if ( $this->_blRenderer ) {
145  $sWarning .= "--!--RENDERER--!--";
146  }
147 
148  return $sWarning . __CLASS__ . " (time: ". date('Y-m-d H:i:s') ."): [{$this->code}]: {$this->message} \n Stack Trace: {$this->getTraceAsString()}\n\n";
149  }
150 
156  /*
157  public function __toString()
158  {
159  return $this->getString();
160  }
161  */
169  public function getValues()
170  {
171  return array();
172  }
173 
181  public function setDestination( $sDestination )
182  {
183  }
184 }