yiisoft /
db
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Yiisoft\Db\Exception; |
||
| 6 | |||
| 7 | use Stringable; |
||
| 8 | |||
| 9 | /** |
||
| 10 | * Represents an exception that's caused by some DB-related operations. |
||
| 11 | * |
||
| 12 | * It provides more information about the error that's caused by the exception. |
||
| 13 | */ |
||
| 14 | class Exception extends \Exception implements Stringable |
||
| 15 | { |
||
| 16 | public function __construct(string $message, public array|null $errorInfo = [], \Exception $previous = null) |
||
| 17 | { |
||
| 18 | 261 | parent::__construct($message, 0, $previous); |
|
| 19 | } |
||
| 20 | 261 | ||
| 21 | 261 | /** |
|
| 22 | 261 | * @return string Readable representation of exception. |
|
| 23 | */ |
||
| 24 | public function __toString(): string |
||
| 25 | { |
||
| 26 | return parent::__toString() . PHP_EOL . 'Additional Information:' . PHP_EOL . print_r($this->errorInfo, true); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 27 | 5 | } |
|
| 28 | } |
||
| 29 |