<?php
 abstract class vB_Exception extends Exception { use vB_Trait_NoSerialize; protected $critical; protected $option_mail; protected $option_log; protected $config_debug; protected $logged; protected $mailed; public static function getFullTrace(Throwable $e) { return '## ' . $e->getFile() . '(' . $e->getLine() . ") Exception Thrown \n" . $e->getTraceAsString(); } public function __construct($message, $code = false, $file = false, $line = false) { parent::__construct($message, $code); if ($code) { $this->code = $code; } if ($file) { $this->file = $file; } if ($line) { $this->line = $line; } } public function logError() { if ($this->logged) { return; } $this->logged = true; } public function mailError() { if ($this->mailed) { return; } $this->mailed = true; } public function toString($verbose = false) { $str = $this->message . "\r\n"; if ($verbose) { $str .= "********************\r\n"; $str .= 'Time: ' . date('l dS \of F Y h:i:s A') . "\r\n"; $str .= "Stack Trace:\r\n" . self::getFullTrace($this) . "\r\n"; } return $str; } public function __toString() { return $this->toString(); } public function isCritical() { return $this->critical; } } 