| 1 |
<?php |
| 2 |
/* |
| 3 |
* License: GPLv3 |
| 4 |
* License URI: https://www.gnu.org/licenses/gpl.txt |
| 5 |
* Copyright 2012-2026 Jean-Sebastien Morisset (https://wpsso.com/) |
| 6 |
*/ |
| 7 |
|
| 8 |
if ( ! defined( 'ABSPATH' ) ) { |
| 9 |
|
| 10 |
die( 'These aren\'t the droids you\'re looking for.' ); |
| 11 |
} |
| 12 |
|
| 13 |
if ( ! defined( 'WPSSO_PLUGINDIR' ) ) { |
| 14 |
|
| 15 |
die( 'Do. Or do not. There is no try.' ); |
| 16 |
} |
| 17 |
|
| 18 |
if ( ! class_exists( 'SucomErrorException' ) ) { |
| 19 |
|
| 20 |
require_once WPSSO_PLUGINDIR . 'lib/com/exception.php'; |
| 21 |
} |
| 22 |
|
| 23 |
if ( ! class_exists( 'WpssoErrorException' ) ) { |
| 24 |
|
| 25 |
class WpssoErrorException extends SucomErrorException { |
| 26 |
|
| 27 |
protected $p; |
| 28 |
|
| 29 |
public function __construct( $errstr = '', $errcode = null, $severity = E_ERROR, $filename = __FILE__, $lineno = __LINE__, ?Exception $previous = null ) { |
| 30 |
|
| 31 |
$this->p =& Wpsso::get_instance(); |
| 32 |
|
| 33 |
if ( $this->p->debug->enabled ) { |
| 34 |
|
| 35 |
$this->p->debug->mark(); |
| 36 |
} |
| 37 |
|
| 38 |
parent::__construct( $errstr, $errcode, $severity, $filename, $lineno, $previous ); // Calls SucomErrorException::__construct(). |
| 39 |
} |
| 40 |
|
| 41 |
public function errorMessage( $ret = false ) { |
| 42 |
|
| 43 |
/* |
| 44 |
* getMessage(); // Message of exception. |
| 45 |
* getCode(); // Code of exception. |
| 46 |
* getFile(); // Source filename. |
| 47 |
* getLine(); // Source line. |
| 48 |
* getTrace(); // An array of the backtrace(). |
| 49 |
* getPrevious(); // Previous exception. |
| 50 |
* getTraceAsString(); // Formatted string of trace. |
| 51 |
*/ |
| 52 |
$errstr = $this->getMessage(); |
| 53 |
|
| 54 |
if ( $this->p->debug->enabled ) { |
| 55 |
|
| 56 |
$this->p->debug->log( $errstr ); |
| 57 |
} |
| 58 |
|
| 59 |
$this->p->notice->err( $errstr ); |
| 60 |
} |
| 61 |
} |
| 62 |
} |
| 63 |
|