1<?php
2
3
4namespace ComboStrap;
5
6
7use Throwable;
8
9/**
10 * Class ExceptionCombo
11 * @package ComboStrap
12 * Adds the canonical
13 */
14class ExceptionCompile  extends \Exception
15{
16    /**
17     * @var mixed|string
18     */
19    private $canonical;
20
21    public function __construct($message = "", $canonical = "", $code = 0, Throwable $previous = null)
22    {
23        $this->canonical = $canonical;
24        parent::__construct($message, $code, $previous);
25    }
26
27    /**
28     * @return mixed|string
29     */
30    public function getCanonical()
31    {
32        return $this->canonical;
33    }
34
35    public static function withMessageAndError(string $message, Throwable $previous)
36    {
37        $calledClass = get_called_class();
38        return new $calledClass($message, "support", 1, $previous);
39    }
40
41
42}
43