Skip to content

Commit c397c26

Browse files
committed
Merge pull request laravel#1221 from arisk/patch-1
Added PDO error code
2 parents 1824b0b + 752161c commit c397c26

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

laravel/database/exception.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ public function __construct($sql, $bindings, \Exception $inner)
2222
$this->inner = $inner;
2323

2424
$this->setMessage($sql, $bindings);
25+
26+
// Set the exception code
27+
$this->code = $inner->getCode();
2528
}
2629

2730
/**
@@ -47,5 +50,5 @@ protected function setMessage($sql, $bindings)
4750

4851
$this->message .= "\n\nSQL: ".$sql."\n\nBindings: ".var_export($bindings, true);
4952
}
50-
53+
5154
}

0 commit comments

Comments
 (0)