SQLException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 8
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 3
1
<?php
2
3
namespace DrMVC\Database;
4
5
/**
6
 * Wrapper for PDOException
7
 *
8
 * @package DrMVC\Database
9
 * @since   3.0
10
 */
11
class SQLException extends \PDOException
12
{
13
    public function __construct(string $message = '', int $code = 0, \Throwable $previous = null)
14
    {
15
        parent::__construct($message, $code, $previous);
16
17
        error_log(
18
            'Uncaught Error: ' . $this->getMessage() . ' in ' . $this->getFile() . ':' . $this->getLine() . "\n"
19
            . "Stack trace:\n" . $this->getTraceAsString() . "\n"
20
            . '  thrown in ' . $this->getFile() . ' on line ' . $this->getLine()
21
        );
22
    }
23
}
24