46 lines
877 B
PHP
46 lines
877 B
PHP
<?php
|
|
|
|
class mfExceptionhandler {
|
|
private $Code;
|
|
private $Message;
|
|
private $timestamp;
|
|
private $Time;
|
|
private $Trace;
|
|
private $TraceS;
|
|
|
|
public function __construct(Exception $e) {
|
|
$this->Code=(int)$e->getCode();
|
|
$this->Message=$e->getMessage();
|
|
$this->timestamp=date('U');
|
|
$this->Time=date('Y-m-s H:i:s',$this->timestamp);
|
|
$this->Trace = $e->getTrace();
|
|
$this->TraceS = $e->getTraceAsString();
|
|
|
|
}
|
|
|
|
public function getTrace() {
|
|
return $this->Trace;
|
|
}
|
|
|
|
public function getTraceAsString() {
|
|
return $this->TraceS;
|
|
}
|
|
|
|
public function __toString() {
|
|
$str="[".$this->Time."] ";
|
|
if(is_numeric($this->Code) && $this->Code > 0) {
|
|
$str.="(Error code ".$this->Code.") ";
|
|
}
|
|
|
|
$str.=$this->Message;
|
|
return (string) $str;
|
|
}
|
|
|
|
public function __get($name) {
|
|
if(property_exists($this, $name)) {
|
|
return $this->$name;
|
|
}
|
|
return null;
|
|
}
|
|
}
|