2016-09-30 01:58:09 +00:00
|
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace JKingWeb\NewsSync\Lang;
|
|
|
|
|
2017-02-11 19:56:02 +00:00
|
|
|
class Exception extends \JKingWeb\NewsSync\AbstractException {
|
2017-02-16 20:29:42 +00:00
|
|
|
static $test = false; // used during PHPUnit testing only
|
2017-02-08 21:53:02 +00:00
|
|
|
|
2017-02-16 20:29:42 +00:00
|
|
|
function __construct(string $msgID = "", $vars = null, \Throwable $e = null) {
|
|
|
|
if(!self::$test) {
|
|
|
|
parent::__construct($msgID, $vars, $e);
|
|
|
|
} else {
|
|
|
|
$codeID = "Lang/Exception.$msgID";
|
|
|
|
if(!array_key_exists($codeID,self::CODES)) {
|
|
|
|
$code = -1;
|
|
|
|
$msg = "Exception.".str_replace("\\","/",parent::class).".uncoded";
|
|
|
|
$vars = $msgID;
|
|
|
|
} else {
|
|
|
|
$code = self::CODES[$codeID];
|
|
|
|
$msg = "Exception.".str_replace("\\","/",__CLASS__).".$msgID";
|
|
|
|
}
|
|
|
|
\Exception::__construct($msg, $code, $e);
|
|
|
|
}
|
|
|
|
}
|
2016-09-30 01:58:09 +00:00
|
|
|
}
|