Conditions | 1 |
Paths | 1 |
Total Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 1 |
Changes | 0 |
1 | <?php |
||
16 | 5 | public function __construct(\PDOException $e, $extraMessage = '') |
|
17 | { |
||
18 | // Strip boring unnecessary info from error message |
||
19 | 5 | $strippedMsg = preg_replace('/SQLSTATE\[[A-Za-z-0-9]+\]( \[[A-Za-z-0-9]+\])?:?\s?/', '', $e->getMessage()); |
|
20 | |||
21 | // PDOExceptions' getCode() can return a code with letters, which normal |
||
22 | // exceptions won't accept. A converted code is better than no code at all though. |
||
23 | 5 | parent::__construct($strippedMsg . $extraMessage, (int) $e->getCode()); |
|
24 | 5 | } |
|
25 | } |
||
26 |