OXID eShop CE  4.9.5
 All Classes Files Functions Variables Pages
oxexception.php
Go to the documentation of this file.
1 <?php
2 
7 class oxException extends Exception
8 {
9 
15  protected $_sFileName = 'EXCEPTION_LOG.txt';
16 
23  protected $_blRenderer = false;
24 
30  protected $_blNotCaught = false;
31 
38  public function __construct($sMessage = "not set", $iCode = 0)
39  {
40  parent::__construct($sMessage, $iCode);
41  }
42 
48  public function setLogFileName($sFile)
49  {
50  $this->_sFileName = $sFile;
51  }
52 
58  public function getLogFileName()
59  {
60  return $this->_sFileName;
61  }
62 
68  public function setMessage($sMessage)
69  {
70  $this->message = $sMessage;
71  }
72 
76  public function setRenderer()
77  {
78  $this->_blRenderer = true;
79  }
80 
86  public function isRenderer()
87  {
88  return $this->_blRenderer;
89  }
90 
94  public function setNotCaught()
95  {
96  $this->_blNotCaught = true;
97  }
98 
104  public function isNotCaught()
105  {
106  return $this->_blNotCaught;
107  }
108 
112  public function debugOut()
113  {
114  //We are most likely are already dealing with an exception so making sure no other exceptions interfere
115  try {
116  $sLogMsg = $this->getString() . "\n---------------------------------------------\n";
117  oxRegistry::getUtils()->writeToLog($sLogMsg, $this->getLogFileName());
118  } catch (Exception $e) {
119  }
120  }
121 
128  public function getString()
129  {
130  $sWarning = "";
131  if ($this->_blNotCaught) {
132  $sWarning .= "--!--NOT CAUGHT--!--";
133  }
134 
135  if ($this->_blRenderer) {
136  $sWarning .= "--!--RENDERER--!--";
137  }
138 
139  return $sWarning . __CLASS__ . " (time: " . date('Y-m-d H:i:s') . "): [{$this->code}]: {$this->message} \n Stack Trace: {$this->getTraceAsString()}\n\n";
140  }
141 
147  /*
148  public function __toString()
149  {
150  return $this->getString();
151  }
152  */
160  public function getValues()
161  {
162  return array();
163  }
164 
170  public function setDestination($sDestination)
171  {
172  }
173 }