This repository has been archived by the owner. It is now read-only.
forked from ifacesoft/ice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathException.php
71 lines (61 loc) · 1.67 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
62
63
64
65
66
67
68
69
70
71
<?php
namespace ice;
use ErrorException;
/**
* Class Exception
*
* Exception of ice application
*
* @package ice
* @author dp <[email protected]>
* @since -0
*/
class Exception extends ErrorException
{
/**
* Error context data
* @var array
*/
private $errcontext = null;
/**
* Constructor exception of ice application
*
* Simple constructor for fast throws Exception
*
* @param string $errstr message of exception
* @param array $errcontext context data of exception
* @param Exception $previous previous exception if exists
* @param string $errfile filename where throw Exception
* @param int $errline number of line where throws Exception
* @param int $errno code of error exception
*/
public function __construct($errstr, $errcontext = [], $previous = null, $errfile = null, $errline = null, $errno = 0)
{
$this->errcontext = $errcontext;
// $config = Config::get(__CLASS__);
//
// $message = $config->get($errstr . '/' . Request::locale(), false);
// if (!$message) {
$message = $errstr;
// }
$debug = debug_backtrace();
if (!$errfile) {
/** @var Exception $exception */
$exception = reset($debug)['object'];
$errfile = $exception->getFile();
$errline = $exception->getLine();
}
parent::__construct($message, $errno, 1, $errfile, $errline, $previous);
}
/**
* Return error context data
*
* Data in moment throws exception
*
* @return array
*/
public function getErrContext()
{
return $this->errcontext;
}
}