OXID eShop CE  4.10.2
 All Classes Namespaces Files Functions Variables Pages
oxexception.php
Go to the documentation of this file.
1 <?php
2 
7 class oxException extends Exception
8 {
9 
17  protected $_sFileName = 'EXCEPTION_LOG.txt';
18 
25  protected $_blRenderer = false;
26 
32  protected $_blNotCaught = false;
33 
40  public function __construct($sMessage = "not set", $iCode = 0)
41  {
42  parent::__construct($sMessage, $iCode);
43  }
44 
52  public function setLogFileName($sFile)
53  {
54  $this->_sFileName = $sFile;
55  }
56 
64  public function getLogFileName()
65  {
66  return $this->_sFileName;
67  }
68 
74  public function setMessage($sMessage)
75  {
76  $this->message = $sMessage;
77  }
78 
82  public function setRenderer()
83  {
84  $this->_blRenderer = true;
85  }
86 
92  public function isRenderer()
93  {
94  return $this->_blRenderer;
95  }
96 
100  public function setNotCaught()
101  {
102  $this->_blNotCaught = true;
103  }
104 
110  public function isNotCaught()
111  {
112  return $this->_blNotCaught;
113  }
114 
118  public function debugOut()
119  {
120  //We are most likely are already dealing with an exception so making sure no other exceptions interfere
121  try {
122  $sLogMsg = $this->getString() . "\n---------------------------------------------\n";
123  //deprecated since v5.3 (2016-06-17); Logging mechanism will be changed in 6.0.
124  oxRegistry::getUtils()->writeToLog($sLogMsg, $this->getLogFileName());
125  //end deprecated
126  } catch (Exception $e) {
127  }
128  }
129 
136  public function getString()
137  {
138  $sWarning = "";
139  if ($this->_blNotCaught) {
140  $sWarning .= "--!--NOT CAUGHT--!--";
141  }
142 
143  if ($this->_blRenderer) {
144  $sWarning .= "--!--RENDERER--!--";
145  }
146 
147  return $sWarning . __CLASS__ . " (time: " . date('Y-m-d H:i:s') . "): [{$this->code}]: {$this->message} \n Stack Trace: {$this->getTraceAsString()}\n\n";
148  }
149 
155  /*
156  public function __toString()
157  {
158  return $this->getString();
159  }
160  */
168  public function getValues()
169  {
170  return array();
171  }
172 
178  public function setDestination($sDestination)
179  {
180  }
181 }