-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathException.php
61 lines (56 loc) · 1.52 KB
/
Exception.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php declare(strict_types = 1);
namespace noxkiwi\core;
use noxkiwi\hook\Hook;
/**
* I am the Core project's base exception.
* I am abstract to force developers to introduce their own Exception types.
*
* @package noxkiwi\core
* @author Jan Nox <[email protected]>
* @license https://nox.kiwi/license
* @copyright 2016 - 2021 noxkiwi
* @version 1.1.2
* @link https://nox.kiwi/
*/
abstract class Exception extends \Exception
{
/** @var int I am the Exception's error level */
private int $level;
/** @var mixed I am the Exception error info */
private mixed $info;
/**
* Create an errormessage that will stop execution of this Request.
*
* @param string $code
* @param int $level
* @param mixed $info
*
* @throws \noxkiwi\singleton\Exception\SingletonException
*/
final public function __construct(string $code, int $level, $info = null)
{
parent::__construct($code, $level);
$this->message = $code;
$this->code = $code;
$this->level = $level;
$this->info = $info;
Hook::getInstance()->fire($code);
Hook::getInstance()->fire('EXCEPTION');
}
/**
* I will return the Level of this Exception.
* @return int
*/
final public function getLevel(): int
{
return $this->level;
}
/**
* I will return the info of the Exception
* @return mixed
*/
final public function getInfo(): mixed
{
return $this->info;
}
}